Closed jhlabs closed 7 years ago
How are you calling the update?
It looks like you are just providing something like { name: 'Johannes' }
as the payload.
You probably need to call the the update method like this:
this.updateUser([this.currentUserId, { ...this.getCurrentUser, name: 'Johannes' }])
But it would probably be better to use patch so you don't have to sent the rest of the data from the current user again
@jskrzypek thanks for the reply. Your solution adds the new value indeed to the store, but for me not to the feathers backend. I am trying to follow the patch instructions from the docs here:
It is actually just a type in the docs that causes the problem. This is the current doc for patch:
let data = {description: 'write your tests', completed: true}
let params = {}
store.dispatch('todos/update', [1, data, params])
But it should actually state:
let data = {description: 'write your tests', completed: true}
let params = {}
store.dispatch('todos/patch', [1, data, params])
Then everything works fine with just adding the changed values as payload. @marshallswain I am new to programming and don't want to mess up your docs :). Do you agree with the change?
Ah, yes. Thanks @Johannes90. I've fixed this in the 1.0 branch.
Steps to reproduce
I want to populate a name field for one record of the user model that has already been created. The Vue component for this process:
Expected behavior
The action should update the vuex state and database entries in the feathers backend.
Actual behavior
The action triggers a mutation, as seen in the Vue Dev tools, but there is no value updated: There is no change added in the backend either.
System configuration
feathers-vuex config
package.json