payload-authjs
Version:
A Payload CMS 3 plugin for Auth.js 5
46 lines (45 loc) • 1.37 kB
TypeScript
import type { CollectionSlug } from "payload";
import { type ReactNode } from "react";
import type { PayloadSession } from "./getPayloadSession";
export interface SessionContext<TSlug extends CollectionSlug> {
/**
* The status of the session
*/
status: "loading" | "authenticated" | "unauthenticated";
/**
* The session
*/
session: PayloadSession<TSlug> | null;
/**
* Function to refresh the session
*/
refresh: () => Promise<PayloadSession<TSlug> | null>;
/**
* Function to refetch the session from the server
*/
refetch: () => Promise<PayloadSession<TSlug> | null>;
}
export declare const Context: import("react").Context<SessionContext<never>>;
interface Props<TSlug extends CollectionSlug> {
/**
* The slug of the collection that contains the users
*
* @default "users"
*/
userCollectionSlug?: TSlug;
/**
* The session from the server
*
* @default null
*/
session?: PayloadSession<TSlug> | null;
/**
* The children to render
*/
children: ReactNode;
}
/**
* PayloadSessionProvider that provides the session to the context provider
*/
export declare const PayloadSessionProvider: <TSlug extends CollectionSlug = "users">({ userCollectionSlug, session, children, }: Props<TSlug>) => import("react").JSX.Element;
export {};