This commit is contained in:
comodo 2021-02-09 03:46:46 +00:00 committed by GitHub
commit 6789fc8758
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -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 }})
}
}
}

View File

@ -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()
}
}