@topsoft4u/next-auth
Version:
Authentication helper for next.js using SWR
16 lines (15 loc) • 660 B
TypeScript
import { Fetcher } from "swr/dist/types";
export declare type UseUserProps<Data, Error = any> = {
loginUrl: string;
isLoggedIn: (user?: Data) => boolean;
swrKey?: string;
swrFetcher?: Fetcher<Data>;
redirectQueryParam?: string;
redirectIf?: "GUEST" | "USER" | "NEVER";
redirectTo?: string;
};
export declare const useUser: <Data>({ swrKey, swrFetcher, isLoggedIn, loginUrl, redirectQueryParam, redirectIf, redirectTo }: UseUserProps<Data, any>) => {
user: Data;
isLoggedIn: boolean;
setUser: (data?: Data | Promise<Data> | import("swr/dist/types").MutatorCallback<Data>, shouldRevalidate?: boolean) => Promise<Data>;
};