feat: add admin auth session expiration handling
Add auth session utilities and event handling in src/lib/auth-session.ts Integrate auth expiration checks in API request and uploadMediaAsset functions Update App component to subscribe to auth expired events and update auth state Add test suite for the auth session utility function Adjust maintenance grid CSS layout Remove unused UI components and imports in StructurePage
This commit is contained in:
11
tests/auth-session.test.ts
Normal file
11
tests/auth-session.test.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
|
||||
import { shouldExpireAdminSession } from "../src/lib/auth-session.js";
|
||||
|
||||
test("only token-backed 401 responses expire the admin session", () => {
|
||||
assert.equal(shouldExpireAdminSession(401, true), true);
|
||||
assert.equal(shouldExpireAdminSession(401, false), false);
|
||||
assert.equal(shouldExpireAdminSession(403, true), false);
|
||||
assert.equal(shouldExpireAdminSession(500, true), false);
|
||||
});
|
||||
Reference in New Issue
Block a user