fix(dev): avoid auth redirect when backend/schema missing

This commit is contained in:
Zimeng Xiong
2026-02-06 09:50:27 -08:00
parent 7977a3eb09
commit b075a0cf9e
2 changed files with 7 additions and 2 deletions
+1
View File
@@ -4,6 +4,7 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"predev": "node -e \"process.env.DATABASE_URL=process.env.DATABASE_URL||'file:./prisma/dev.db'; require('child_process').execSync('npx prisma migrate deploy', { stdio: 'inherit' });\"",
"dev": "nodemon src/index.ts", "dev": "nodemon src/index.ts",
"test": "vitest run", "test": "vitest run",
"test:watch": "vitest", "test:watch": "vitest",
+6 -2
View File
@@ -60,8 +60,12 @@ export const AuthProvider: React.FC<{ children: ReactNode }> = ({ children }) =>
return; return;
} }
} catch { } catch {
// If status fails, assume auth is enabled (safer default). // If status fails (backend down / schema mismatch), avoid locking the UI
setAuthEnabled(true); // behind login. Backend still enforces auth when enabled.
setAuthEnabled(false);
setBootstrapRequired(false);
setUser(null);
return;
} }
const storedUser = localStorage.getItem(USER_KEY); const storedUser = localStorage.getItem(USER_KEY);