fix:重定向白屏需强刷bug

This commit is contained in:
guoyue 2022-09-29 11:02:23 +08:00
parent a7d7431c75
commit 3f4e27177c
1 changed files with 15 additions and 6 deletions

View File

@ -32,12 +32,13 @@ const handleCode = (code, msg, res) => {
// debugger // debugger
switch (code) { switch (code) {
case 401: case 401:
store.dispatch('user/resetAll').catch(() => {}) debugger
store.dispatch('user/resetAll').catch(() => { })
break break
case 403: case 403:
router.push({ router.push({
path: '/401' path: '/401'
}).catch(() => {}) }).catch(() => { })
break break
case 500: case 500:
message.error(msg || '接口异常') message.error(msg || '接口异常')
@ -111,7 +112,15 @@ instance.interceptors.response.use(
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 _new_href = response.headers.redirect.split('#')[0];
window.location.replace(response.headers.redirect) window.location.replace(response.headers.redirect)
// url
if (_old_href === _new_href) {
location.reload()
}
// location.reload()
// 西- // 西-
// if(!whoShow.itShowXiHaiAn) { // if(!whoShow.itShowXiHaiAn) {
// location.reload() // location.reload()