We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d936a52 commit 1c084b5Copy full SHA for 1c084b5
frontend/src/services/api.ts
@@ -12,8 +12,14 @@ const api = axios.create({
12
api.interceptors.response.use(
13
(response) => response,
14
(error) => {
15
- if (error.response?.status === 401) {
16
- window.location.href = '/login';
+ // Don't redirect on 401 for auth status checks - that's expected when not logged in
+ const isAuthStatusCheck = error.config?.url?.includes('/auth/status');
17
+
18
+ if (error.response?.status === 401 && !isAuthStatusCheck) {
19
+ // Only redirect if we're not already on the login page
20
+ if (window.location.pathname !== '/login') {
21
+ window.location.href = '/login';
22
+ }
23
}
24
return Promise.reject(error);
25
0 commit comments