perf: 移动端token过期之后循环刷新页面

This commit is contained in:
fit2cloud-chenyw 2023-12-18 12:44:28 +08:00
parent 9c394cc30e
commit bdb2a2dac7

View File

@ -159,12 +159,17 @@
const param = getUrlParams(url)
if (param?.detoken) {
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)
getInfo().then(res => {
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
})
return true