Skip to content

Commit

Permalink
fix(ui): redirects to main when auth is disabled (#854)
Browse files Browse the repository at this point in the history
* fix(ui): redirects to main when auth is disabled

* fix: fix redirects
  • Loading branch information
robertsLando authored Mar 9, 2021
1 parent b555724 commit 8f4f181
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
4 changes: 4 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 8f4f181

Please sign in to comment.