7339d51acf
Vite bakes VITE_* vars at build time, so hardcoding a URL in .env.production breaks CI E2E which runs on localhost. Now falls back to the browser origin at runtime, which works correctly since nginx reverse-proxies /api to the local API container. Fixes GRO-1280.
7 lines
246 B
TypeScript
7 lines
246 B
TypeScript
import { createAuthClient } from "better-auth/react";
|
|
|
|
export const authClient = createAuthClient({
|
|
baseURL: import.meta.env.VITE_API_URL || window.location.origin,
|
|
});
|
|
|
|
export const { signIn, signOut, useSession, changePassword } = authClient; |