this is my first time to develop a react application.
This is my current code for calling the API call. But once this method is called, the api calls it in parallel. I want it to call it by sequence and once it fails, it will stop. How to apply promise.resolve on this method?
Thank you very much
const doReprocess = (txnSeqs = []) => {
txnSeqs.forEach(async txnSeq => {
setIsReprocessing(txnSeq, ReprocessStatus.RUNNING);
try {
const result = await axios.post(apiBaseUrl + txnSeq, {}, {
headers: {
'Content-Type': 'application/json'
}
});
setIsReprocessing(txnSeq, ReprocessStatus.SUCCESS, result);
} catch (err) {
setIsReprocessing(txnSeq, ReprocessStatus.ERROR, err.response.data || err);
}
});
}