diff --git a/web-src/src/utils/http/index.ts b/web-src/src/utils/http/index.ts index ab0f1d6..221bc50 100644 --- a/web-src/src/utils/http/index.ts +++ b/web-src/src/utils/http/index.ts @@ -135,6 +135,14 @@ class PureHttp { $error.isCancelRequest = Axios.isCancel($error); // 关闭进度条动画 NProgress.done(); + if ($error.response.status === 401) { + router.replace({ + path: "/login", + query: { + redirect: router.currentRoute.value.fullPath + } + }); + } // 所有的响应异常 区分来源为取消请求/非取消请求 return Promise.reject($error); }