UNPKG

react-firehooks

Version:

Lightweight dependency-free collection of React hooks for Firebase

13 lines (12 loc) 654 B
import { Auth, AuthError } from "firebase/auth"; import { ValueHookResult } from "../common/index.js"; export type UseAuthIdTokenResult = ValueHookResult<string | null, AuthError>; /** * Returns and updates the JWT of the currently authenticated user * @param auth Firebase Auth instance * @returns JWT, loading state, and error * - value: JWT; `undefined` if the JWT is currently being fetched, or an error occurred * - loading: `true` while fetching the JWT; `false` if the JWT was fetched successfully or an error occurred * - error: `undefined` if no error occurred */ export declare function useAuthIdToken(auth: Auth): UseAuthIdTokenResult;