I have this URL. How can I translate it into params for axios?
customer?$select[0]=id&$select[1]=firstName&$select[2]=lastName&$select[3]=email&$skip=0&$sort[createdAt]=-1&[email protected]
const { data } = await this.request({
method: 'get',
url: `/customer`,
params: {
// ?
},
});
CodePudding user response:
Usually simply by setting a property with a key and value.
params: { email: "[email protected]" }
In cases where the key contains special characters, which are not allowed for property keys in JS, you can set the key in quotation marks
params: { "$select[1]": "firstSame" }