'How to pass parameter in mapActions in vuex

I want to pass the parameter in mapAction in the computed property.

just like we can pass parameter in mounted.

this.$store.dispatch('GET_SUB_CATEGORIES', this.$store.getters.GET_BUSINESS_INFO.category_id)

I want to send parameter with mapAction

computed: {
   ...mapActions(['GET_SUB_CATEGORIES', ]),
},

in the computed property.



Solution 1:[1]

It's preety straight forward.

mutations: {
    yourMutation (state, payload) {
      state.yourParameter = payload
    }
  },
  actions: {
    mapThis (context, payload) {
      context.commit('yourMutation', payload)
    }
  }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Guy Nachshon