We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 21acd12 commit 75eb711Copy full SHA for 75eb711
1 file changed
frontend/src/lib/api.ts
@@ -9,7 +9,14 @@ api.interceptors.response.use(
9
(res) => res,
10
(err) => {
11
if (err.response?.status === 401) {
12
- window.location.href = '/login'
+ const url = err.config?.url || ''
13
+ const path = window.location.pathname
14
+ // Don't redirect if already on auth pages or if it's a /me check
15
+ const isAuthPage = path === '/login' || path === '/register' || path === '/reset-password'
16
+ const isMeCheck = url.includes('/auth/me')
17
+ if (!isAuthPage && !isMeCheck) {
18
+ window.location.href = '/login'
19
+ }
20
}
21
return Promise.reject(err)
22
0 commit comments