(no commit message provided)
Co-authored-by: aider (openai/DeepSeek-V3.2-Thinking) <aider@aider.chat>
This commit is contained in:
@ -57,10 +57,13 @@ service.interceptors.response.use(
|
||||
const data = error.response.data
|
||||
|
||||
if (status === 401) {
|
||||
message = '登录已过期,请重新登录'
|
||||
// 这里可以触发登出逻辑
|
||||
localStorage.clear()
|
||||
window.location.href = '/login'
|
||||
// 对于登录接口的401错误,不执行登出重定向,仅提示错误
|
||||
if (error.config && !error.config.url.includes('/login')) {
|
||||
message = '登录已过期,请重新登录'
|
||||
localStorage.clear()
|
||||
window.location.href = '/login'
|
||||
}
|
||||
// 如果是登录接口,message会被后面的data.msg覆盖
|
||||
} else if (status === 403) {
|
||||
message = '权限不足'
|
||||
} else if (status === 404) {
|
||||
@ -78,4 +81,4 @@ service.interceptors.response.use(
|
||||
}
|
||||
)
|
||||
|
||||
export default service
|
||||
export default service
|
||||
|
||||
Reference in New Issue
Block a user