-
Notifications
You must be signed in to change notification settings - Fork 82
Open
Description
Hi!
Sorry if this a very basic question. From the examples in the docs and the source code, I guess I only can fire mutations when a property is set. What about actions? What if I always wanto to call some API before making a mutation? In the example of custom getters and setters, it would be something like this:
Store
// ...
getters: {
getUserField(state) {
return getField(state.user);
},
},
mutations: {
updateUserField(state, field) {
updateField(state.user, field);
},
},
actions: {
updateAsyncUserField(state, field) {
// Async task like a call to some API
updateField(state.user, field);
}
}Component
import { createHelpers } from 'vuex-map-fields';
const { mapFields } = createHelpers({
getterType: 'getUserField',
mutationType: 'updateUserField',
actionType: 'updateAsyncUserField',
});Metadata
Metadata
Assignees
Labels
No labels