Skip to content

Commit

Permalink
docs: add setUser documentation (#565)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 authored Mar 23, 2020
2 parents 8b2aa1b + efa710d commit ba8abae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions docs/api/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ this.$auth.login(/* .... */)
.then(() => this.$toast.success('Logged In!'))
```

### `setUser(user)`

Set user data and update `loggedIn` state.

> **TIP:** This function can be used to set the user using the login response after a successfully login, when [autoFetchUser](../schemes/local.md#autofetchuser) is disabled.
```js
await this.$auth.setUser(user)
```

### `setUserToken(token)`

- Returns: `Promise`
Expand Down
4 changes: 3 additions & 1 deletion docs/schemes/local.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,6 @@ This option can be used to disable all token handling. Useful for Cookie only fl

- Default: `true`

This option can be used to disable user fetch after login. It is useful when your login response already have the user.
This option can be used to disable user fetch after login.

> TIP: It is useful when your login response already have the user. To manually set the user, use [setUser](../api/auth.md#setuser-user).

0 comments on commit ba8abae

Please sign in to comment.