Skip to content

Commit

Permalink
fix(local scheme): return response and catch errors from fetchUser
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoPedroAS51 committed Apr 22, 2020
1 parent fe0736d commit a36b39f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/schemes/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,16 @@ export default class LocalScheme extends BaseScheme<typeof DEFAULTS> {
}

// Try to fetch user and then set
const response = await this.$auth.requestWith(
return this.$auth.requestWith(
this.name,
endpoint,
this.options.endpoints.user
)

this.$auth.setUser(getResponseProp(response, this.options.user.property))
).then((response) => {
this.$auth.setUser(getResponseProp(response, this.options.user.property))
return response
}).catch((error) => {
this.$auth.callOnError(error, { method: 'fetchUser' })
})
}

async logout (endpoint: HTTPRequest = {}) {
Expand Down

0 comments on commit a36b39f

Please sign in to comment.