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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user