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
12 lines
461 B
TypeScript
12 lines
461 B
TypeScript
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);
|
|
});
|