fix(gro-405): devFetch interceptor runs in deployed dev builds

Replace build-time `import.meta.env.DEV` guard with a runtime check
using localStorage presence of a dev user. This ensures the
X-Dev-User-Id header is injected in deployed dev pods (groombook.dev),
not just during local `vite dev`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
groombook-engineer[bot]
2026-04-02 17:34:18 +00:00
parent f4acf5be23
commit a2afc975c1
+3 -2
View File
@@ -9,8 +9,9 @@ const originalFetch = window.fetch;
* Intentionally mutates window.fetch — this is dev-only (AUTH_DISABLED=true).
*/
export function installDevFetchInterceptor() {
// In production, Better-Auth handles auth via cookies — no interception needed
if (!import.meta.env.DEV) return;
// Only install if a dev user is selected (localStorage check, not build-time flag).
// This ensures the interceptor runs in deployed dev builds, not just `vite dev`.
if (!getDevUser()) return;
window.fetch = function (input: RequestInfo | URL, init?: RequestInit) {
const user = getDevUser();