Skip to content

Commit aae26ea

Browse files
committed
Add auth actions example
Closes feathers-plus/docs#47
1 parent d54a91c commit aae26ea

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

docs/auth-plugin.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,30 @@ The following actions are included in the `auth` module. Login is accomplished
5050
If you provided a `userService` and have correctly configured your `entityIdField` and `responseEntityField` (the defaults work with Feathers V4 out of the box), the `user` state will be updated with the logged-in user. The record will also be reactive, which means when the user record updates (in the users service) the auth user will automatically update, as well.
5151

5252
> Note: The Vuex auth store will not update if you use the feathers client version of the above methods.
53+
54+
## Example
55+
56+
Here's a short example that implements the `authenticate` and `logout` actions:
57+
58+
```js
59+
export default {
60+
// ...
61+
methods: {
62+
63+
login() {
64+
this.$store.dispatch('auth/authenticate' {
65+
email: '...',
66+
password: '...'
67+
})
68+
}
69+
70+
// ...
71+
72+
logout() {
73+
this.$store.dispatch('auth/logout')
74+
}
75+
76+
}
77+
// ...
78+
}
79+
```

0 commit comments

Comments
 (0)