From 8f4f181246b0269211568690afe888297b86c0e4 Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Tue, 9 Mar 2021 15:23:04 +0100 Subject: [PATCH] fix(ui): redirects to main when auth is disabled (#854) * fix(ui): redirects to main when auth is disabled * fix: fix redirects --- src/App.vue | 3 ++- src/router/index.js | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/App.vue b/src/App.vue index f94e308e8fe..72a01c164aa 100644 --- a/src/App.vue +++ b/src/App.vue @@ -497,7 +497,8 @@ export default { } if (!newAuth && this.$route.path === Routes.login) { - this.$router.push(Routes.main) + this.$router.push(localStorage.getItem('nextUrl') || Routes.main) + localStorage.removeItem('nextUrl') } this.startSocket() } diff --git a/src/router/index.js b/src/router/index.js index 0d435f3a230..b9fcbf122a4 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -107,6 +107,10 @@ router.beforeEach(async (to, from, next) => { return } + if (store.state.auth === undefined && to.path !== Routes.login) { + localStorage.setItem('nextUrl', to.path) + } + if (store.state.auth === false) { if (to.path === Routes.login) { next({