Skip to content

Commit 16a7904

Browse files
author
Pooya Parsa
committed
feat: add watchLoggedIn option to optionally disable it (#80)
1 parent 2497cc0 commit 16a7904

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/core/auth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default class Auth {
4040
await this.mounted()
4141

4242
// Watch for loggedIn changes only in client side
43-
if (process.browser) {
43+
if (process.browser && this.options.watchLoggedIn) {
4444
this.$storage.watchState('loggedIn', loggedIn => {
4545
if (!routeOption(this.ctx.route, 'auth', false)) {
4646
this.redirect(loggedIn ? 'home' : 'logout')

lib/module/defaults.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ module.exports = {
1313

1414
fullPathRedirect: false,
1515

16+
watchLoggedIn: true,
17+
1618
redirect: {
1719
login: '/login',
1820
logout: '/',

0 commit comments

Comments
 (0)