From 662ce3b484c3726369e4cf6b70fc875e57d2f66e Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期四, 15 四月 2021 11:52:14 +0800 Subject: [PATCH] Merge pull request #84 from lawrencehj/wvp-28181-2.0 --- web_src/src/main.js | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/web_src/src/main.js b/web_src/src/main.js index ed1f36c..56586f5 100644 --- a/web_src/src/main.js +++ b/web_src/src/main.js @@ -40,6 +40,18 @@ axios.defaults.baseURL = (process.env.NODE_ENV === 'development') ? process.env.BASE_API : ""; +// api 杩斿洖401鑷姩鍥炵櫥闄嗛〉闈� +axios.interceptors.response.use(function (response) { + // 瀵瑰搷搴旀暟鎹仛鐐逛粈涔� + return response; +}, function (error) { + // 瀵瑰搷搴旈敊璇仛鐐逛粈涔� + if (error.response.status === 401) { + router.push('/login'); + } + return Promise.reject(error); +}); + Vue.prototype.$cookies.config(60*30); -- Gitblit v1.8.0