fix:token失效时接口返回401后强制跳转登录页,避免停留在空列表页
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
60157025f2
commit
e378bb9e1c
|
|
@ -20,6 +20,9 @@ api.interceptors.response.use(
|
|||
if (error.response?.status === 401) {
|
||||
const { clearAuth } = useAuth()
|
||||
clearAuth()
|
||||
if (window.location.pathname !== '/login') {
|
||||
window.location.replace('/login')
|
||||
}
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue