fix:重定向白屏需强刷bug
This commit is contained in:
parent
a7d7431c75
commit
3f4e27177c
|
@ -32,12 +32,13 @@ const handleCode = (code, msg, res) => {
|
|||
// debugger
|
||||
switch (code) {
|
||||
case 401:
|
||||
store.dispatch('user/resetAll').catch(() => {})
|
||||
debugger
|
||||
store.dispatch('user/resetAll').catch(() => { })
|
||||
break
|
||||
case 403:
|
||||
router.push({
|
||||
path: '/401'
|
||||
}).catch(() => {})
|
||||
}).catch(() => { })
|
||||
break
|
||||
case 500:
|
||||
message.error(msg || '接口异常')
|
||||
|
@ -111,7 +112,15 @@ instance.interceptors.response.use(
|
|||
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()
|
||||
}
|
||||
|
||||
// location.reload()
|
||||
// 西海岸-不重新加载
|
||||
// if(!whoShow.itShowXiHaiAn) {
|
||||
// location.reload()
|
||||
|
|
Loading…
Reference in New Issue