Skip to content

Commit

Permalink
feat: add watchLoggedIn option to optionally disable it (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pooya Parsa committed May 21, 2018
1 parent 2497cc0 commit 16a7904
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/core/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class Auth {
await this.mounted()

// Watch for loggedIn changes only in client side
if (process.browser) {
if (process.browser && this.options.watchLoggedIn) {
this.$storage.watchState('loggedIn', loggedIn => {
if (!routeOption(this.ctx.route, 'auth', false)) {
this.redirect(loggedIn ? 'home' : 'logout')
Expand Down
2 changes: 2 additions & 0 deletions lib/module/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ module.exports = {

fullPathRedirect: false,

watchLoggedIn: true,

redirect: {
login: '/login',
logout: '/',
Expand Down

0 comments on commit 16a7904

Please sign in to comment.