You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
userService:'users', // if your user service endpoint is named 'users'
49
-
entityIdField:'userId', // The property in the payload storing the user id
50
-
responseEntityField:'user', // The property in the payload storing the user
51
-
state: {}, // Custom state
52
-
getters: {}, // Custom getters
53
-
mutations: {}, // Custom mutations
54
-
actions: {} // Custom actions
55
-
})
56
-
]
57
-
})
58
-
```
59
-
60
43
## Actions
61
44
62
-
The following actions are included in the `auth` module:
45
+
The following actions are included in the `auth` module. Login is accomplished through the `authenticate` action. For logout, use the `logout` action. It's important to note that the records that were loaded for a user are NOT automatically cleared upon logout. Because the business logic requirements for that feature would vary from app to app, it can't be baked into Feathers-Vuex. It must be manually implemented. The recommended solution is to simply refresh the browser, which clears the data from memory.
63
46
64
47
-`authenticate`: use instead of `feathersClient.authenticate()`
65
48
-`logout`: use instead of `feathersClient.logout()`
66
49
67
-
> Node: The Vuex auth store may not update if you use the feathers client version of the above methods.
50
+
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.
51
+
52
+
> Note: The Vuex auth store will not update if you use the feathers client version of the above methods.
0 commit comments