UNPKG

@daveyplate/better-auth-tanstack

Version:

Tanstack hooks for better-auth

14 lines (10 loc) 573 B
import { QueryClient } from '@tanstack/react-query'; import { betterAuth } from 'better-auth'; type BetterAuth = ReturnType<typeof betterAuth> type GetSessionParams = Parameters<BetterAuth["api"]["getSession"]>[0]; declare function prefetchSession<TAuth extends BetterAuth>(auth: TAuth, queryClient: QueryClient, params: GetSessionParams, queryKey?: string[]): Promise<{ data: TAuth["$Infer"]["Session"] | null; session: TAuth["$Infer"]["Session"]["session"] | undefined; user: TAuth["$Infer"]["Session"]["user"] | undefined; }>; export { prefetchSession };