[Vuejs]-Store dispatch function not accepting my parameters

0👍

You’re dispatching an action with a single object as the parameters:

this.$store.dispatch('storeFunction', {functionValue1: this.value1, functionValue2: this.value2, functionValue3: this.value3})

But your function accepts three separate parameters:

storeFunction(functionValue1, functionValue2, functionValue3)

The solution should be just to destructure your parameters in the function, like so:

storeFunction({functionValue1, functionValue2, functionValue3})

Or, if you are unable to use this feature, you can do it the ES5 way:

storeFunction(values) {
  var functionValue1 = values.functionValue1
  var functionValue2 = values.functionValue2
  // etc...
}

Leave a comment