mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-06 04:19:20 +00:00
38 lines
662 B
TypeScript
38 lines
662 B
TypeScript
import { createAuthClient } from "better-auth/react";
|
|
import {
|
|
organizationClient,
|
|
passkeyClient,
|
|
twoFactorClient,
|
|
adminClient,
|
|
} from "better-auth/client/plugins";
|
|
import { toast } from "sonner";
|
|
|
|
export const client = createAuthClient({
|
|
plugins: [
|
|
organizationClient(),
|
|
twoFactorClient({
|
|
twoFactorPage: "/two-factor",
|
|
}),
|
|
passkeyClient(),
|
|
adminClient(),
|
|
],
|
|
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;
|