fix: use window.location.origin as fallback for VITE_API_URL

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.
This commit is contained in:
2026-05-14 19:40:59 +00:00
committed by Flea Flicker [agent]
parent 8eec29ad90
commit 7339d51acf
+1 -1
View File
@@ -1,7 +1,7 @@
import { createAuthClient } from "better-auth/react";
export const authClient = createAuthClient({
baseURL: import.meta.env.VITE_API_URL ?? "",
baseURL: import.meta.env.VITE_API_URL || window.location.origin,
});
export const { signIn, signOut, useSession, changePassword } = authClient;