样式优化
This commit is contained in:
@@ -47,46 +47,20 @@ myaxios.interceptors.response.use(async function(response) {
|
||||
}, async function(error) {
|
||||
//未授权、失败
|
||||
const resp = error.response.data
|
||||
|
||||
|
||||
if (resp.code == undefined && resp.message == undefined) {
|
||||
Notify({ type: 'danger', message: '未知错误' });
|
||||
} else if (resp.code == 401) {
|
||||
if (!isRelogin.show) {
|
||||
|
||||
|
||||
|
||||
// if (!isRelogin.show) {
|
||||
Notify({ type: 'warning', message: '登录过期' });
|
||||
//登出
|
||||
useUserStore().logOut().then(() => {
|
||||
location.href = '/';
|
||||
})
|
||||
|
||||
isRelogin.show = false;
|
||||
}
|
||||
// const router = useRouter();
|
||||
// router.push({ path:"/login" });
|
||||
|
||||
// const res = await vm.$dialog.error({
|
||||
// text: `错误代码:${resp.code},原因:${resp.message}<br>是否重新进行登录?`,
|
||||
// title: '错误',
|
||||
// actions: {
|
||||
// 'false': '取消',
|
||||
// 'true': '跳转'
|
||||
// }
|
||||
// });
|
||||
// if (res) {
|
||||
// vm.$router.push({ path: "/login" });
|
||||
// }
|
||||
|
||||
} else if (resp.code !== 200) {
|
||||
Notify({ type: 'danger', message: `错误代码:${resp.code},原因:${resp.message}` });
|
||||
// vm.$dialog.notify.error(`错误代码:${resp.code},原因:${resp.message}`, {
|
||||
// position: "top-right",
|
||||
// timeout: 5000,
|
||||
// });
|
||||
}
|
||||
|
||||
return Promise.reject(error);
|
||||
});
|
||||
export default myaxios
|
||||
Reference in New Issue
Block a user