import type { AuthClient } from "../../lib/auth-client" import { type UseSessionOptions, useSession } from "../../queries/auth/session-query" /** * Retrieve the current authenticated user. Thin wrapper over `useSession` * that returns `session.user` as `data`. * * @param authClient - The Better Auth client. * @param options - `getSession` params & `useQuery` options. */ export function useUser( authClient: TAuthClient, options?: UseSessionOptions ) { const { data, ...rest } = useSession(authClient, options) return { data: data?.user, ...rest } }