I want to hand over variable from my component to store. In component methods i write:
methods:{
push(){
let message = "hi"
this.$store.dispatch('test', message)
}
}
Then in index.js:
actions: {
test({dispatch},{test}){
console.log(test)
},}
And in console i have - undefined
CodePudding user response:
You shouldn't destruct the dispatch payload unless the {test}message parameter has a field called test:
actions: {
test({dispatch},test){
console.log(test)
},}
