登录后返回原始页面功能

This commit is contained in:
honue
2024-03-05 15:20:27 +08:00
parent 73f11b920f
commit 14e776a287
3 changed files with 5 additions and 2 deletions

View File

@@ -162,6 +162,7 @@ router.beforeEach((to, from, next) => {
const isAuthenticated = store.state.auth.token !== null
if (to.meta.requiresAuth && !isAuthenticated) {
store.state.auth.originalPath = to.fullPath
next('/login')
}
else {