UNPKG

@propelauth/react

Version:

A React library for managing authentication, backed by PropelAuth

24 lines (23 loc) 875 B
import { IAuthClient } from "@propelauth/javascript"; import { MutableRefObject } from "react"; declare type ClientRef = { authUrl: string; client: IAuthClient; }; declare type UseClientRefCreateProps = { authUrl: string; minSecondsBeforeRefresh?: number; client?: never; }; declare type UseClientRefExternalProps = { client: IAuthClient; authUrl?: never; minSecondsBeforeRefresh?: never; }; declare type UseClientRefProps = UseClientRefCreateProps | UseClientRefExternalProps; export declare const useClientRef: (props: UseClientRefProps) => { clientRef: MutableRefObject<ClientRef | null>; accessTokenChangeCounter: number; }; export declare const useClientRefCallback: <I extends unknown[], O>(clientRef: MutableRefObject<ClientRef | null>, callback: (client: IAuthClient) => (...inputs: I) => O) => (...inputs: I) => O; export {};