fix: guest route
This commit is contained in:
+3
-2
@@ -29,9 +29,9 @@ api.interceptors.response.use(
|
||||
response => response,
|
||||
error => {
|
||||
const status = error.response?.status
|
||||
const currentPath = window.location.pathname
|
||||
|
||||
if (status === 401) {
|
||||
console.warn('Unauthorized. Redirecting to login...')
|
||||
if (status === 401 && !currentPath.endsWith('/login')) {
|
||||
window.location.href = '/login'
|
||||
}
|
||||
|
||||
@@ -46,3 +46,4 @@ api.interceptors.response.use(
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user