解决token失效 ,登录页面重复跳转登录页面问题
This commit is contained in:
parent
b13a4b01df
commit
416c8df729
|
@ -32,13 +32,9 @@ const err = (error) => {
|
||||||
notification.error({ message: '系统提示', description: '拒绝访问',duration: 4})
|
notification.error({ message: '系统提示', description: '拒绝访问',duration: 4})
|
||||||
break
|
break
|
||||||
case 500:
|
case 500:
|
||||||
let path = window.location.href
|
|
||||||
//notification.error({ message: '系统提示', description:'Token失效,请重新登录!',duration: 4})
|
//notification.error({ message: '系统提示', description:'Token失效,请重新登录!',duration: 4})
|
||||||
if(token && data.message.includes("Token失效") && path.indexOf('/user/login') < 0){
|
if(token && data.message.includes("Token失效")){
|
||||||
// update-begin- --- author:scott ------ date:20190225 ---- for:Token失效采用弹框模式,不直接跳转----
|
// update-begin- --- author:scott ------ date:20190225 ---- for:Token失效采用弹框模式,不直接跳转----
|
||||||
// store.dispatch('Logout').then(() => {
|
|
||||||
// window.location.reload()
|
|
||||||
// })
|
|
||||||
Modal.error({
|
Modal.error({
|
||||||
title: '登录已过期',
|
title: '登录已过期',
|
||||||
content: '很抱歉,登录已过期,请重新登录',
|
content: '很抱歉,登录已过期,请重新登录',
|
||||||
|
@ -48,7 +44,9 @@ const err = (error) => {
|
||||||
store.dispatch('Logout').then(() => {
|
store.dispatch('Logout').then(() => {
|
||||||
Vue.ls.remove(ACCESS_TOKEN)
|
Vue.ls.remove(ACCESS_TOKEN)
|
||||||
try {
|
try {
|
||||||
if(path.indexOf('/user/login')==-1){
|
let path = window.document.location.pathname
|
||||||
|
console.log("location pathname -> "+path)
|
||||||
|
if(path!="/" && path.indexOf('/user/login')==-1){
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
}
|
}
|
||||||
}catch (e) {
|
}catch (e) {
|
||||||
|
|
Loading…
Reference in New Issue