2
votes

I don't know how to call, multiple NamespacedHelpers with vuex, i tried this:

import { createNamespacedHelpers } from 'vuex'
const { mapActions, mapMutations } = createNamespacedHelpers(['payments', 'auth'])
methods: {
    ...mapActions(['registerBankData', 'updateBankData', 'getBankData'], ['login']),
    ...mapMutations(['setBankData']),
...
}

Also tried this:

import { createNamespacedHelpers } from 'vuex'
const { mapActions, mapMutations } = createNamespacedHelpers('payments', 'auth')
methods: {
    ...mapActions(['registerBankData', 'updateBankData', 'getBankData', 'login']),
    ...mapMutations(['setBankData']),
...
}

but doesn't work..

2

2 Answers

2
votes

Try something like that:

import { mapMutations, mapActions } from 'vuex';

export default {
  methods: {
    ...mapMutations({
      myMutation: 'myModule/myMutation',
    }),
    ...mapActions({
      myAction: 'myModule/myAction',
    }),
  }
}
1
votes

I believe you can do this

import { createNamespacedHelpers } from 'vuex'
const payments = createNamespacedHelpers('payments')
const auth = createNamespacedHelpers('auth')

methods: {
    ...payments.mapActions(['registerBankData', 'updateBankData', 'getBankData']),
    ...auth.mapActions(['authAction', 'login']),
    ...payments.mapMutations(['setBankData']),
...
}