react-firehooks
Version:
Lightweight dependency-free collection of React hooks for Firebase
13 lines (12 loc) • 729 B
TypeScript
import { Auth, AuthError, IdTokenResult } from "firebase/auth";
import { ValueHookResult } from "../common/index.js";
export type UseAuthIdTokenResultResult = ValueHookResult<IdTokenResult | null, AuthError>;
/**
* Returns and updates the deserialized JWT of the currently authenticated user
* @param auth Firebase Auth instance
* @returns Deserialized JWT, loading state, and error
* - value: Deserialized JWT; `undefined` if the JWT is currently being fetched, or an error occurred
* - loading: `true` while fetching JWT; `false` if the JWT was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export declare function useAuthIdTokenResult(auth: Auth): UseAuthIdTokenResultResult;