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
I made a profile page to update the logged in users information.
The flow i used for that is
const{ User }=this.$FeathersVuex.api;letuser=User.getFromStore(authUser._id);if(!user){user=awaitUser.get(authUser._id);}this.user=user.clone();
I then edit the copy and call this.user.save() once I'm done to commit the changes and update the server.
This does not appear to update authenticated user in the store state.auth.user.
To fix this i added the following to my makeAuthPlugin which takes the user information returned from the server upon login and creates a User model using that information and now the auth.user automatically updates since i now clone the model from auth and save that instead.
actions: {responseHandler({ commit, state },response){constapiService="api";if(state.userService){letuser=response[state.responseEntityField];constModel=Object.keys(models[apiService]).map(modelName=>models[apiService][modelName]).find(model=>model.servicePath===state.userService);if(Model){user=newModel({ ...response.user});commit("setUser",user);}}}}
Am i doing something wrong, since i would expect the auth.user to be reactive by default, or was that changed in the 2.0 pre-release? And if that is the case, is the above approach the correct one to solve the issue?
I'm using feathers: 4.3.7 on the server and client and feathers-vuex: 2.0.0-pre78
The text was updated successfully, but these errors were encountered:
So I've tried to follow the docs and 2.0 PR #216
Got everything working pretty well. I can login and send messages back and forth.
(Followed this guide for the flow https://docs.feathersjs.com/guides/basics/setup.html)
I made a profile page to update the logged in users information.
The flow i used for that is
I then edit the copy and call
this.user.save()
once I'm done to commit the changes and update the server.This does not appear to update authenticated user in the store
state.auth.user
.To fix this i added the following to my
makeAuthPlugin
which takes the user information returned from the server upon login and creates a User model using that information and now theauth.user
automatically updates since i now clone the model fromauth
and save that instead.Am i doing something wrong, since i would expect the
auth.user
to be reactive by default, or was that changed in the 2.0 pre-release? And if that is the case, is the above approach the correct one to solve the issue?I'm using
feathers: 4.3.7
on the server and client andfeathers-vuex: 2.0.0-pre78
The text was updated successfully, but these errors were encountered: