From f0fd0efb7f46bb9918aa0117e8cc07f9719aaa81 Mon Sep 17 00:00:00 2001 From: Julien Aldon Date: Tue, 10 Mar 2026 11:38:26 +0100 Subject: [PATCH] add status check after refetch --- frontend/src/services/api.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/src/services/api.ts b/frontend/src/services/api.ts index e40a9ab..7de27be 100644 --- a/frontend/src/services/api.ts +++ b/frontend/src/services/api.ts @@ -50,6 +50,13 @@ export async function fetchWithAuth(input: RequestInfo, options?: RequestInit, r credentials: "include", ...options, }); + if (res.status === 401) { + if (redirect) + window.location.href = `/?sessionExpired=True`; + const error = new Error("Unauthorized"); + error.cause = 401 + throw error; + } return newRes; } if (res.status == 403) {