重定向解注

This commit is contained in:
guoyue 2022-10-08 14:20:51 +08:00
parent 667d53484e
commit 7b4b410538
1 changed files with 20 additions and 20 deletions

View File

@ -82,9 +82,9 @@ instance.interceptors.request.use(
if (debounce.some((item) => config.url.includes(item))) { if (debounce.some((item) => config.url.includes(item))) {
// //
} }
// if (!config.headers.REQUESTURI) { if (!config.headers.REQUESTURI) {
// config.headers.REQUESTURI = window.location.href config.headers.REQUESTURI = window.location.href
// } }
return config return config
}, },
@ -108,19 +108,19 @@ instance.interceptors.response.use(
message message
} = response.data } = response.data
// if (response.headers.token) { if (response.headers.token) {
// setAccessToken(response.headers.token) setAccessToken(response.headers.token)
// } }
// if (response.headers.redirect) { if (response.headers.redirect) {
// const _old_href = window.location.href.split('#')[0]; const _old_href = window.location.href.split('#')[0];
// const _new_href = response.headers.redirect.split('#')[0]; const _new_href = response.headers.redirect.split('#')[0];
// window.location.replace(response.headers.redirect) window.location.replace(response.headers.redirect)
// // url // url
// if (_old_href === _new_href) { if (_old_href === _new_href) {
// location.reload() location.reload()
// } }
// return response return response
// } }
if (response.headers.redirect === '/#/login') { if (response.headers.redirect === '/#/login') {
var keys = document.cookie.match(/[^ =;]+(?=\=)/g) var keys = document.cookie.match(/[^ =;]+(?=\=)/g)
if (keys) { if (keys) {
@ -179,10 +179,10 @@ instance.interceptors.response.use(
if (response.headers.token) { if (response.headers.token) {
setAccessToken(response.headers.token) setAccessToken(response.headers.token)
} }
// if (response.headers.redirect) { if (response.headers.redirect) {
// window.location.replace(response.headers.redirect) window.location.replace(response.headers.redirect)
// return Promise.resolve() return Promise.resolve()
// } }
const { const {
status, status,
data data