I've used Promise.all()
to get every request.
But I have got an error message from the server that I requested too many calls in a short period because the number of array I requested is over 100.
How can I improve my Promise codes to calling a next request after finishing the first request?
public getProfits(data) {
return Promise.all(
data.map((obj) => {
return this.getProfit(obj.symbol).then(rawData => {
obj.stat = rawData
return obj;
});
})
).then(data => {
this.data = this.dataService.ascArray(data, 'symbol')
})
}