Skip to content

Commit

Permalink
fix(watch loggedIn): disable redirect on direct page loads (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
SnooHD authored and pi0 committed Apr 27, 2018
1 parent 8275e60 commit 0386eb9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/core/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
})
Expand Down

0 comments on commit 0386eb9

Please sign in to comment.