From 0386eb956e4162be80159c35429f6a84e3d522e6 Mon Sep 17 00:00:00 2001 From: Mike de Snoo Date: Fri, 27 Apr 2018 04:56:01 -0300 Subject: [PATCH] fix(watch loggedIn): disable redirect on direct page loads (#158) --- lib/core/auth.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/core/auth.js b/lib/core/auth.js index f03222a78..08a878f83 100644 --- a/lib/core/auth.js +++ b/lib/core/auth.js @@ -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') } })