mirror of
https://github.com/Mail-0/Zero.git
synced 2026-07-01 08:16:28 +00:00
15 lines
516 B
TypeScript
15 lines
516 B
TypeScript
import { customSessionClient } from 'better-auth/client/plugins';
|
|
import { createAuthClient } from 'better-auth/react';
|
|
import type { Auth } from '@zero/server/auth';
|
|
|
|
export const authClient = createAuthClient({
|
|
baseURL: process.env.NEXT_PUBLIC_BACKEND_URL,
|
|
fetchOptions: {
|
|
credentials: 'include',
|
|
},
|
|
plugins: [customSessionClient<Auth>()],
|
|
});
|
|
|
|
export const { signIn, signUp, signOut, useSession, getSession, $fetch } = authClient;
|
|
export type Session = Awaited<ReturnType<Auth['api']['getSession']>>;
|