The problem
I am using axios to post multiple request to an API, the order these request reach the API is important. Even though the requests are been sent in the correct order, they are been handled in the wrong order on the API layer (response is been sent back in the incorrect order).
e.g. i send request A and then B, but received the response B first and then A.
What i am doing currently
const requests = request.map(req => {
return post<void>(url, params)
.then(response => {
console.log(`response sent`);
})
.catch(err => {
console.log(`Response not sent`, err);
});
});
await Promise.all(requests);