fix
This commit is contained in:
@@ -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)
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user