Skip to content
Permalink
Browse files
fix(watch loggedIn): disable redirect on direct page loads (#158)
  • Loading branch information
SnooHD authored and pi0 committed Apr 27, 2018
1 parent 8275e60 commit 0386eb956e4162be80159c35429f6a84e3d522e6
Showing 1 changed file with 5 additions and 0 deletions.
@@ -27,6 +27,11 @@ export default class Auth {
if (process.browser) {
this.$storage.watchState('loggedIn', loggedIn => {
if (!routeOption(this.ctx.route, 'auth', false)) {
//disable redirect on refresh / direct load of a page.
if(loggedIn && !this.ctx.from) {
return
}

this.redirect(loggedIn ? 'home' : 'logout')
}
})

0 comments on commit 0386eb9

Please sign in to comment.