perf: 移动端token过期之后循环刷新页面
This commit is contained in:
parent
9c394cc30e
commit
bdb2a2dac7
@ -159,12 +159,17 @@
|
|||||||
const param = getUrlParams(url)
|
const param = getUrlParams(url)
|
||||||
if (param?.detoken) {
|
if (param?.detoken) {
|
||||||
if(param.detoken.endsWith('#/'))
|
if(param.detoken.endsWith('#/'))
|
||||||
param.detoken = param.detoken.substr(0, param.detoken.length - 2)
|
param.detoken = param.detoken.substr(0, param.detoken.length - 2)
|
||||||
|
|
||||||
|
const redirect = window.location.href.split('?')[0]
|
||||||
setToken(param.detoken)
|
setToken(param.detoken)
|
||||||
getInfo().then(res => {
|
getInfo().then(res => {
|
||||||
setUserInfo(res.data)
|
setUserInfo(res.data)
|
||||||
const redirect = window.location.href.split('?')[0]
|
window.location.href = redirect
|
||||||
|
}).catch(() => {
|
||||||
|
setToken(null)
|
||||||
|
localStorage.removeItem('Authorization')
|
||||||
|
window.cookieStore.delete('Authorization')
|
||||||
window.location.href = redirect
|
window.location.href = redirect
|
||||||
})
|
})
|
||||||
return true
|
return true
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user