I got 2 modules #module A
const state = {
a: '',
b: '',
c: '',
}
const mutations = {
reset(state) {
state.a = ''
state.b = ''
state.c = ''
}
}
I use vuex-map-fields to enable two-way-binding in componentA
After that I want to fetch all states of module A to module B (state.items), and RESET after done fetching #module B
const state = {
items: []
},
const mutations = {
addItem (state) {
state.items.push(moduleA.state)
},
}
I tried
dispatch('moduleB/addItems')
commit('molduleA/reset')
with data of moduleA
const state = {
a: '1',
b: '2',
c: '3',
}
but it's not working, only store reset state of moduleA
#resultOfModuleB
const state = {
items: [
{a:'', b:'', c:''}
]
},
If I only dispatch(‘moduleB/addItems’), it's working
const state = {
items: [
{a:'1', b:'2', c:'3'}
]
},
What is the best way to do? Thanks in advance