mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-07 04:19:22 +00:00
docs: last changes
This commit is contained in:
35
examples/nextjs-example/lib/auth-client.ts
Normal file
35
examples/nextjs-example/lib/auth-client.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { createAuthClient } from "better-auth/react";
|
||||
import {
|
||||
organizationClient,
|
||||
passkeyClient,
|
||||
twoFactorClient,
|
||||
} from "better-auth/client/plugins";
|
||||
import { toast } from "sonner";
|
||||
|
||||
export const client = createAuthClient({
|
||||
plugins: [
|
||||
organizationClient(),
|
||||
twoFactorClient({
|
||||
twoFactorPage: "/two-factor",
|
||||
}),
|
||||
passkeyClient(),
|
||||
],
|
||||
fetchOptions: {
|
||||
onError(e) {
|
||||
if (e.error.status === 429) {
|
||||
toast.error("Too many requests. Please try again later.");
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const {
|
||||
signUp,
|
||||
signIn,
|
||||
signOut,
|
||||
useSession,
|
||||
user,
|
||||
organization,
|
||||
useListOrganizations,
|
||||
useActiveOrganization,
|
||||
} = client;
|
||||
Reference in New Issue
Block a user