Download frontend/src/lib/auth-client.ts from new-arc/vector: direct link, hf CLI and curl.
- Browser
- Download file 820 Bytes
-
https://huggingface.co/spaces/new-arc/vector/resolve/main/frontend/src/lib/auth-client.ts
- Command line
-
hf download hf://spaces/new-arc/vector/frontend/src/lib/auth-client.ts
-
curl -L -o auth-client.ts https://huggingface.co/spaces/new-arc/vector/resolve/main/frontend/src/lib/auth-client.ts
820 Bytes
| import { createAuthClient } from "better-auth/react"; | |
| import { useSyncExternalStore } from "react"; | |
| export const authClient = createAuthClient(); | |
| export const { signIn, signOut, signUp, requestPasswordReset, resetPassword } = authClient; | |
| const subscribeToHydration = () => () => {}; | |
| const clientSnapshot = () => true; | |
| const serverSnapshot = () => false; | |
| export function useSession(...args: Parameters<typeof authClient.useSession>) { | |
| const session = authClient.useSession(...args); | |
| const hydrated = useSyncExternalStore(subscribeToHydration, clientSnapshot, serverSnapshot); | |
| // A sibling can resolve the shared auth store before this component hydrates. | |
| // Match the server's loading state until this consumer finishes hydration. | |
| return hydrated ? session : { ...session, data: null, isPending: true }; | |
| } | |