This commit is contained in:
2025-10-25 15:42:19 +08:00
parent d3700c8835
commit fff309f56b

View File

@@ -53,9 +53,7 @@ http.interceptors.response.use(
if (error.response.status === 401) {
// 清除token并重定向到登录页
localStorage.removeItem('jwt_token');
// 这里需要访问router但http.js是纯工具文件不应直接依赖Vue Router实例
// 可以在main.js的全局错误处理或组件中处理401错误
// 例如window.location.href = '/login';
window.location.href = '/login';
}
} else if (error.request) {
// 请求发出但没有收到响应