fix:token失效时接口返回401后强制跳转登录页,避免停留在空列表页

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
caoqianming 2026-04-23 13:40:29 +08:00
parent 60157025f2
commit e378bb9e1c
1 changed files with 3 additions and 0 deletions

View File

@ -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)
}