This commit is contained in:
X1627315083
2025-10-24 15:18:23 +08:00
parent 6ff592208e
commit d5e8d00234
4 changed files with 40 additions and 37 deletions

View File

@@ -83,31 +83,33 @@ service.interceptors.response.use(
}
},
(error) => {
if(error?.response?.status === 401){//如果是记录浏览器页面就不跳转login
// showConfirmDialog({
// title: '确定登出',
// message: '你已被登出,可以取消继续留在该页面,或者重新登录',
// confirmButtonText: '重新登录',
// cancelButtonText: '取消'
// }).then(() => {
// store.loginOut().then(() => {
// location.reload() // 为了重新实例化vue-router对象 避免bug
// })
// })
router.replace('/login')
return Promise.reject(error)
}
error.config && removePending(error.config)
// 关闭loading
if (error.config?.loading) {
closeLoading()
}
console.log('err' + error) // for debug
showToast({
message: error.message,
type: 'fail',
duration: 5000
})
if(error?.response){
if(error?.response?.status === 401){//如果是记录浏览器页面就不跳转login
// showConfirmDialog({
// title: '确定登出',
// message: '你已被登出,可以取消继续留在该页面,或者重新登录',
// confirmButtonText: '重新登录',
// cancelButtonText: '取消'
// }).then(() => {
// store.loginOut().then(() => {
// location.reload() // 为了重新实例化vue-router对象 避免bug
// })
// })
router.replace('/login')
return Promise.reject(error)
}
error.config && removePending(error.config)
// 关闭loading
if (error.config?.loading) {
closeLoading()
}
console.log('err' + error) // for debug
showToast({
message: error.message,
type: 'fail',
duration: 5000
})
}
return Promise.reject(error)
}
)