fix(portal): redirect unauthenticated users to login — never show portal chrome (GRO-309) #191
@@ -31,10 +31,21 @@ test.describe("ImpersonationBanner", () => {
|
|||||||
await page.route("**/api/impersonation/sessions/session-1/audit-log", (route) =>
|
await page.route("**/api/impersonation/sessions/session-1/audit-log", (route) =>
|
||||||
route.fulfill({ json: { logs: [] } })
|
route.fulfill({ json: { logs: [] } })
|
||||||
);
|
);
|
||||||
// Portal session endpoints needed when CustomerPortal fetches client profile after session is established
|
// Portal session endpoint: CustomerPortal.tsx expects a FLAT ImpersonationSession object
|
||||||
// FIX: nest session data under 'session' key so CustomerPortal.tsx can read data.session
|
|
||||||
await page.route("POST **/api/portal/dev-session", (route) =>
|
await page.route("POST **/api/portal/dev-session", (route) =>
|
||||||
route.fulfill({ json: { session: { id: "session-1", client: { id: "client-1", name: "Carol Client" } } } })
|
route.fulfill({
|
||||||
|
json: {
|
||||||
|
id: "session-1",
|
||||||
|
staffId: "staff-1",
|
||||||
|
clientId: "client-1",
|
||||||
|
reason: null,
|
||||||
|
status: "active",
|
||||||
|
startedAt: new Date().toISOString(),
|
||||||
|
endedAt: null,
|
||||||
|
expiresAt: new Date(Date.now() + 3600000).toISOString(),
|
||||||
|
createdAt: new Date().toISOString(),
|
||||||
|
},
|
||||||
|
})
|
||||||
);
|
);
|
||||||
await page.route("GET **/api/portal/me", (route) =>
|
await page.route("GET **/api/portal/me", (route) =>
|
||||||
route.fulfill({ json: { id: "client-1", name: "Carol Client", email: "carol@test.com" } })
|
route.fulfill({ json: { id: "client-1", name: "Carol Client", email: "carol@test.com" } })
|
||||||
|
|||||||
Reference in New Issue
Block a user