优化路由跳转逻辑
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import axios from 'axios';
|
||||
import router from '@/router';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import { getToken, removeToken } from '@/utils/auth';
|
||||
import { Modal, notification } from 'ant-design-vue';
|
||||
import type { AxiosInstance, AxiosRequestConfig } from "axios";
|
||||
import type { ApiResponse } from "@/api/common/model";
|
||||
@@ -52,7 +52,8 @@ service.interceptors.response.use(
|
||||
title: "系统提示",
|
||||
content: "登录状态已过期,请重新登录",
|
||||
onOk: () => {
|
||||
router.push("/login");
|
||||
removeToken();
|
||||
router.replace('/login');
|
||||
},
|
||||
});
|
||||
return Promise.reject(data);
|
||||
|
||||
Reference in New Issue
Block a user