优化路由跳转逻辑

This commit is contained in:
tao
2025-12-18 17:24:36 +08:00
parent ac35b819a7
commit e80b9c95dc

View File

@@ -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);