没有权限或者退出登录跳转到登录页面时当前页面url的query未设置
This commit is contained in:
parent
33a93a12b4
commit
71c8ca4411
|
@ -76,7 +76,8 @@ export default {
|
|||
},
|
||||
async logout() {
|
||||
await this.$store.dispatch('user/logout')
|
||||
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
|
||||
const { path, query } = this.$route
|
||||
this.$router.push({ path: '/login', query: { redirect: path, ...query }})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ router.beforeEach(async(to, from, next) => {
|
|||
// remove token and go to login page to re-login
|
||||
await store.dispatch('user/resetToken')
|
||||
Message.error(error || 'Has Error')
|
||||
next(`/login?redirect=${to.path}`)
|
||||
next({ path: '/login', query: { redirect: to.path, ...to.query }})
|
||||
NProgress.done()
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ router.beforeEach(async(to, from, next) => {
|
|||
next()
|
||||
} else {
|
||||
// other pages that do not have permission to access are redirected to the login page.
|
||||
next(`/login?redirect=${to.path}`)
|
||||
next({ path: '/login', query: { redirect: to.path, ...to.query }})
|
||||
NProgress.done()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue