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) {