Reputation: 930
i struggle to do something that look simple with axios :
Here is my axios query :
axios.get('/consumption_reports', {
params: {
exists: {
energyDeliveryPoint : false
}
}
})
The result is this query :
consumption_reports?exists={"energyDeliveryPoint":false}
When i would like this result :
consumption_reports?exists[energyDeliveryPoint]=false
I tried many different solution but could not found the one that works.
I look forward any answer that keep code simple.
PS : I do not want to hard code the url with my desired behavior.
Upvotes: 0
Views: 183
Reputation: 1597
import axios from 'axios';
const {data} = await axios.get('http://httpbin.org/get', {
params: {
exists: {
energyDeliveryPoint : false
}
}
});
console.log(axios.VERSION, data.url); // 1.3.0 http://httpbin.org/get?exists[energyDeliveryPoint]=false
Upvotes: 1
Reputation: 930
I finally found myself, in that case i have no choice to do this :
axios.get('/consumption_reports', {
params: {
"exists[energyDeliveryPoint]": false
}
})
Upvotes: 0