重定向解注
This commit is contained in:
parent
667d53484e
commit
7b4b410538
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue