M39: harden application and acceptance gates
This commit is contained in:
@@ -18,8 +18,14 @@ const AuthContext = createContext<AuthState | undefined>(undefined);
|
||||
const STORAGE_KEY = "mobilityops.demo-user";
|
||||
|
||||
function readCachedUser(): CurrentUser | null {
|
||||
const stored = sessionStorage.getItem(STORAGE_KEY);
|
||||
return stored ? (JSON.parse(stored) as CurrentUser) : null;
|
||||
try {
|
||||
const stored = sessionStorage.getItem(STORAGE_KEY);
|
||||
return stored ? (JSON.parse(stored) as CurrentUser) : null;
|
||||
} catch {
|
||||
// A corrupted or blocked sessionStorage must never prevent the app from booting;
|
||||
// the session endpoint remains the source of truth.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function cacheUser(user: CurrentUser | null) {
|
||||
|
||||
Reference in New Issue
Block a user