Desired query string format:
http://fqdn/page?categoryID=1&categoryID=2
Axios get request function:
requestCategories () {
return axios.get(globalConfig.CATS_URL, {
params: {
...(this.category ? { categoryId: this.category } : {})
}
})
.then((resp) => {
// console.log(resp)
})
.catch((err) => {
console.log(err)
})
}
The function works correctly with single values for parameters, but encounters an issue when trying to pass multiple values. Attempted to use an array:
...(this.category ? { categoryId: [1, 2] } : {})
However, the resulting query string is:
http://fqdn/page?categoryID[]=1&categoryID[]=2
Unfortunately, this method does not work as expected. Referenced a related issue on Stack Overflow at: Passing an object with a parameter with multiple values as a query string in a GET using axios
Unable to determine the solution from the provided information.