I am trying to remove an array of id's that has to be removed in the backend. I am going to use an endpoint that will take this and execute the delete request with redux. It will be at the endpoint:
DELETE /api/v1/algo/configs?configIds=1,2,3
The 1, 2 , and 3 just represents dummy id's. Which are passed as query parameter and the response would look something like this:
{
"configIds": ["1","2","3"]
}
These above is what should be returned(the deleted array)
Here is what I have so far on the frontend, which is a handler that should asyncronously remove the array one by one so that rate limit is not going crazy.
async function deleteAll() {
for (const id in filteredStoppedConfigs) {
await actions.clearAllConfigs(filteredStoppedConfigs[id]);
}
}
filteredStoppedConfigs is an array of id numbers to remove
And here is an endpoint I have already implemented to delete one id. It works and does the job. But not sure how to implement it at the new endpoint which deletes a whole array. Essentially clearing the whole array
async function deleteConfig(configId) {
const options = {
method: 'DELETE',
headers: {
'content-type': 'application/json'
},
url: `${ALGOS_API_ROOT}/configs/${configId}`
};
return axios(options);
}
Been trying to research online but no one really asked a similar question. Any help is appreciated. Thanks!