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

24 lines (21 loc) 765 B
import { createUseAuth, AuthProvider } from "@happykit/auth-email" export const publicConfig = { baseUrl: (() => { if (process.env.VERCEL_GITHUB_COMMIT_REF === "master") return process.env.PRODUCTION_BASE_URL if (process.env.NODE_ENV === "production") return `https://${process.env.VERCEL_URL}` return "http://localhost:3000" })(), identityProviders: {}, // Possible configuration: // redirects: { // afterSignIn: "/?afterSigIn=true", // afterSignOut: "/?afterSignOut=true", // afterChangePassword: "/?afterChangePassword=true", // afterResetPassword: "/?afterResetPassword=true", // }, } /* you can probably leave these as they are */ export { AuthProvider } export const useAuth = createUseAuth(publicConfig)