[Vuejs]-Vuex: using moduled Mutations and vuex's createNamespacedHelpers API

0👍

It would be:

import { createNamespacedHelpers } from 'vuex';
const { mapMutations } = createNamespacedHelpers('surfGroups');

and then in your methods:

methods: {
  ...mapMutations({myMutation: 'SET_CREATING_SURF_GROUP_LOADING'})
}

next, in your code you need to call this mutation:

this.myMutation(true)

Vuex docs: https://vuex.vuejs.org/guide/mutations.html#committing-mutations-in-components

Leave a comment