axiosInstance redirects users to / on every 401 Unauthorized response using window.location.href. The stored auth token is not cleared before redirecting, which can leave invalid credentials in localStorage and repeatedly trigger unauthorized requests after reload.
Using window.location.href also forces a full page reload instead of SPA navigation, causing poor UX and possible redirect loops.
axiosInstanceredirects users to/on every401 Unauthorizedresponse usingwindow.location.href. The stored auth token is not cleared before redirecting, which can leave invalid credentials in localStorage and repeatedly trigger unauthorized requests after reload.Using
window.location.hrefalso forces a full page reload instead of SPA navigation, causing poor UX and possible redirect loops.