Feat/update login flow reload page (#467)

* update spacing event modal

* update spacing create calendar modal

* fix evenchip description color

* using variant instead of sx

* update login flow

* fix: add useEffect import back to Calendar.tsx
This commit is contained in:
lenhanphung
2026-01-26 17:13:26 +07:00
committed by GitHub
parent 18c0ffb8bf
commit 7058f1c2d6
9 changed files with 284 additions and 80 deletions
+14 -1
View File
@@ -50,7 +50,19 @@ export const api = ky.extend({
afterResponse: [
async (request, options, response) => {
if (response.status === 401) {
// Attempt token refresh on unauthorized response
// Check if we're already on login flow to prevent redirect loop
const currentPath = window.location.pathname;
if (currentPath === "/" || currentPath === "/callback") {
return response;
}
// Check if we have a token in the request
const hasAuthHeader = request.headers.has("Authorization");
if (!hasAuthHeader) {
return response;
}
// Only redirect to SSO if we're sure token is invalid (not just missing)
const loginurl = await Auth();
sessionStorage.setItem(
@@ -62,6 +74,7 @@ export const api = ky.extend({
);
redirectTo(loginurl.redirectTo);
}
return response;
},
],
},