Skip to content
Permalink
Browse files
feat(local scheme): add autoFetchUser option (#543)
  • Loading branch information
JoaoPedroAS51 committed Mar 3, 2020
1 parent ab75ebc commit 344920c0c2d90a6db6265eb286f42f64d1da6ac7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
@@ -35,6 +35,7 @@ auth: {
},
// tokenRequired: true,
// tokenType: 'bearer'
// autoFetchUser: true
}
}
}
@@ -83,3 +84,9 @@ This option can be used to disable all token handling. Useful for Cookie only fl
- Default: `Bearer`

Authorization header type to be used in axios requests.

### `autoFetchUser`

- Default: `true`

This option can be used to disable user fetch after login. It is useful when your login response already have the user.
@@ -51,7 +51,9 @@ export default class LocalScheme {
this._setToken(token)
}

return this.fetchUser()
if (this.options.autoFetchUser) {
await this.fetchUser()
}
}

async setUserToken (tokenValue) {
@@ -114,5 +116,6 @@ const DEFAULTS = {
tokenRequired: true,
tokenType: 'Bearer',
globalToken: true,
tokenName: 'Authorization'
tokenName: 'Authorization',
autoFetchUser: true
}

0 comments on commit 344920c

Please sign in to comment.