diff --git a/src/router.js b/src/router.js index 19ec9ef46ed..ae65066d529 100644 --- a/src/router.js +++ b/src/router.js @@ -70,7 +70,7 @@ const router = createRouter({ await localeManager.changeLanguage(locale) } if (to.meta.requiresAuth && !store.user.token) { - return next({ name: 'sign-in' }) + return next({ name: 'sign-in', query: { redirect: to.fullPath } }) } next() diff --git a/src/views/SignIn.vue b/src/views/SignIn.vue index 775254de62d..2d00b5a227c 100644 --- a/src/views/SignIn.vue +++ b/src/views/SignIn.vue @@ -105,7 +105,8 @@ export default { }) }, done() { - this.$router.push({ path: '/dashboard', query: { signinSuccess: 'true' } }) + const path = this.$route.query.redirect || '/dashboard' + this.$router.push({ path: path, query: { signinSuccess: 'true' } }) } }, };