Q:

Vue sending param value, declaring which param to send as

I have a vue function that I'm calling on page creation called fetchReport
That works fine, and I also have 2 other functions that I'm calling on change of select elements, which work as well, but here's my problem:
Currently, if I call handleTypeSelect or handleLocationSelect, they both submit the correct value but they submit it as itemType in the fetchReport call every time. I"m assuming it's because they only send one parameter value and that's the first parameter.
How can I modify this so that handleTypeSelect sends the value as itemType and handleLocationSelect sends the value as locationID?
created() {
    this.fetchReport();
},
methods: {
  fetchReport(itemType = '3', locationID = '10', startDate = new Date().toISOString().substring(0,10), endDate = new Date().toISOString().substring(0,10)) {
      axios.get('/report/assets/data', {params:{itemType: itemType, startDate: startDate, endDate: endDate, locationID: locationID}})
      .then(response => {
        // handle success
        console.log(response.data)
        this.rows = response.data
      })
  },
  handleTypeSelect() {
      this.fetchReport(itemTypes.value);
  },
  handleLocationSelect() {
      this.fetchReport(itemLocations.value);
  }
}

A:

Refactor fetchReport's arguments:
Instead of taking a series of arguments (arg1, arg2, arg3), take a single parameter (arg)
This arg parameter will be an object including all the properties you need as arguments. As a followup, move the default values inside the function.
Result for you would be:
  fetchReport(myParams) {
      const defaults = { itemType: '3', locationID: '10', .... }; // list all other defaults, same as previous arguments
      const params = Object.assign(defaults, myParams);
      axios.get('/report/assets/data', { params })
      .then(response => {
        // handle success
        console.log(response.data)
        this.rows = response.data
      })
  },

Then, when you need to call fetchReport:
fetchReport({ itemType: 'MyValue' })
fetchReport({ locationID: 'MyValue' })
This is the best practice way of handling functions with multiple parameters when you don't want to think about order of parameters

