generated from nhcarrigan/template
fix: suppress expired-token log noise and redirect expired sessions to login
- authMiddleware no longer logs token expiry as an error; only tampered or malformed tokens (genuinely suspicious) trigger logger.error - fetchJson clears elysium_token and elysium_save_signature from localStorage and redirects to / on any 401, so players with expired sessions see the login page instead of a stuck error screen
This commit is contained in:
@@ -92,6 +92,11 @@ const fetchJson = async <T>(
|
||||
= typeof errorBody.error === "string"
|
||||
? errorBody.error
|
||||
: "Unknown error";
|
||||
if (response.status === 401) {
|
||||
globalThis.localStorage.removeItem("elysium_token");
|
||||
globalThis.localStorage.removeItem("elysium_save_signature");
|
||||
globalThis.location.href = "/";
|
||||
}
|
||||
if (response.status >= 400 && response.status < 500) {
|
||||
throw new ValidationError(message, response.status);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user