From b5e03395d4b614dd2c05d3218c5b51cc8e081d23 Mon Sep 17 00:00:00 2001 From: Rudra-clrscr Date: Tue, 23 Jun 2026 18:46:45 +0530 Subject: [PATCH] fix: redirect to the actual login route on 401, not a nonexistent /login axiosInstance's response interceptor cleared the session and redirected to /login on any 401, but the router only defines /, /register, /app and /dashboard - / renders the Login page. Hitting /login landed on a blank page with no way back in, since there's no matching route or catch-all. Found while testing an unrelated change: an expired/invalid token on /dashboard blanked the screen instead of bouncing back to login. --- frontend/src/utils/axiosInstance.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/utils/axiosInstance.js b/frontend/src/utils/axiosInstance.js index 03fb5a5..38830d0 100644 --- a/frontend/src/utils/axiosInstance.js +++ b/frontend/src/utils/axiosInstance.js @@ -14,7 +14,7 @@ api.interceptors.response.use( if (err.response?.status === 401) { localStorage.removeItem('token'); localStorage.removeItem('user'); - window.location.href = '/login'; + window.location.href = '/'; } return Promise.reject(err); }