UNPKG

@happykit/auth-email

Version:

- A `useAuth` hook which returns the current user - An optional `getServerSideAuth` for server-side rendering - HappyAuth is tiny - it adds only 4.6 kB to the first load JS - it adds less than 0.04 kB if you're transitioning from another page - Extremely

15 lines (14 loc) 969 B
import { NextApiRequest, NextApiResponse } from "next"; import fetch from "isomorphic-unfetch"; import { PublicConfig } from ".."; import { AuthRouteHandlerOptions, ServerConfig } from "../api"; export { fetch }; export declare const publicConfig: PublicConfig; export declare const serverConfig: ServerConfig; export declare function createAuthRouteHandlerOptions(defaultServerConfig?: ServerConfig): AuthRouteHandlerOptions; export declare function createApi(handler: (req: NextApiRequest, res: NextApiResponse<any>) => Promise<void>, params?: any): Promise<[string, () => void]>; export declare function handler(prepare: (() => (req: NextApiRequest, res: NextApiResponse<any>) => Promise<any>) | { handle: () => (req: NextApiRequest, res: NextApiResponse<any>) => Promise<any>; params?: any; }, testFn: (url: string) => Promise<void>): () => Promise<void>; export declare function createAuthCookie(options: AuthRouteHandlerOptions, payload: object): string;