From 14aa35bd1172fd7b0094402ed9b2688fec2fe6b3 Mon Sep 17 00:00:00 2001 From: guoyue Date: Sat, 8 Oct 2022 11:52:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E6=8E=89=E9=87=8D=E5=AE=9A?= =?UTF-8?q?=E5=90=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/src/utils/request.js | 40 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/front/src/utils/request.js b/front/src/utils/request.js index 4721f5c7..9b597979 100644 --- a/front/src/utils/request.js +++ b/front/src/utils/request.js @@ -82,9 +82,9 @@ instance.interceptors.request.use( if (debounce.some((item) => config.url.includes(item))) { //这里写加载动画 } - if (!config.headers.REQUESTURI) { - config.headers.REQUESTURI = window.location.href - } + // if (!config.headers.REQUESTURI) { + // config.headers.REQUESTURI = window.location.href + // } return config }, @@ -108,19 +108,19 @@ instance.interceptors.response.use( message } = response.data - if (response.headers.token) { - setAccessToken(response.headers.token) - } - if (response.headers.redirect) { - const _old_href = window.location.href.split('#')[0]; - const _new_href = response.headers.redirect.split('#')[0]; - window.location.replace(response.headers.redirect) - // url 相同,强制刷新 - if (_old_href === _new_href) { - location.reload() - } - return response - } + // if (response.headers.token) { + // setAccessToken(response.headers.token) + // } + // if (response.headers.redirect) { + // const _old_href = window.location.href.split('#')[0]; + // const _new_href = response.headers.redirect.split('#')[0]; + // window.location.replace(response.headers.redirect) + // // url 相同,强制刷新 + // if (_old_href === _new_href) { + // location.reload() + // } + // return response + // } if (response.headers.redirect === '/#/login') { var keys = document.cookie.match(/[^ =;]+(?=\=)/g) if (keys) { @@ -179,10 +179,10 @@ instance.interceptors.response.use( if (response.headers.token) { setAccessToken(response.headers.token) } - if (response.headers.redirect) { - window.location.replace(response.headers.redirect) - return Promise.resolve() - } + // if (response.headers.redirect) { + // window.location.replace(response.headers.redirect) + // return Promise.resolve() + // } const { status, data