UNPKG

@auth-kit/next

Version:

Next Js Plugin for React Auth Kit

40 lines (39 loc) 991 B
/** * Component Props for Auth Outlet */ interface NextAuthProps { /** * Path to redirect if the user is not authenticated * * @deprecated Use AuthProvider fallpackPath prop instead. * Will be removed in the upcoming version * @example * `/login` */ fallbackPath?: string; } /** * React hook to implement the NextAuth feature * @param arg - Params of the hook * @returns - Authentication Ready state * * @remarks * Usage of this hook will make the page CSR, any SSR will not work in * private routes, as the private data in stored on the client side, * only CSR is available at this moment. * * @example * ```jsx * 'use client' * import { useAuth } from "@auth-kit/next/useAuth" * export default function Layout({ * children, * }: { * children: React.ReactNode * }) { * return useAuth({ fallbackPath: '/login'}) && children; * } * ``` */ export default function useNextAuth({ fallbackPath }: NextAuthProps): boolean; export {};