If patch method is used via mapActions then get the below error.
But, patch works if called directly via client.service('buy').patch(this.thisOrder.id, this.thisOrder, {})
Error in client
nonIterableRest.js?061d:2 Uncaught TypeError: Invalid attempt to destructure non-iterable instance
at _nonIterableRest (nonIterableRest.js?061d:2)
at _slicedToArray (slicedToArray.js?f3e3:8)
at Store.patch (service-module.actions.js?6ac1:155)
at Array.wrappedActionHandler (vuex.esm.js?2f62:732)
at Store.dispatch (vuex.esm.js?2f62:437)
at Store.boundDispatch [as dispatch] (vuex.esm.js?2f62:331)
at Store.local.dispatch (vuex.esm.js?2f62:662)
at VueComponent.mappedAction (vuex.esm.js?2f62:935)
mapActions
...mapActions("buy", {
verifyPayment: "patch"
}),
Patch call
return this.verifyPayment(this.thisOrder.id, this.thisOrder, {})
Which version do you have in your node_modules folder. Please check the package.json in node_modules and update here.
Sure.
node_modules
"_from": "feathers-vuex@^2.0.4",
"_id": "[email protected]",
package.json
"feathers-vuex": "^2.0.4",
Could this be because the object/ record is not in the vuex store? FYI. It's a custom feathers service.
@apmcodes I have the same problem here, have you been able to find a solution?
@aessig try passing id and data as an array to mapped action such as patch. Like verifyPayment([id, data, params])
@apmcodes @aessig
That's correct, you need to pass id, data and params in an array as vuex actions only takes one param.
So you must call it like that:
return this.verifyPayment([this.thisOrder.id, this.thisOrder])
Most helpful comment
@apmcodes @aessig
That's correct, you need to pass id, data and params in an array as vuex actions only takes one param.
https://github.com/feathersjs-ecosystem/feathers-vuex/blob/250901daf99ce0512a2046dd94a6ccaea2a5164e/src/service-module/service-module.actions.ts#L148
So you must call it like that: