I have an array of objects and using Promise.all to map values returned from an Api call on a specific property on each object
The initial call looks like the following:
Promise.all(jobs.map(job => convertItemsl(job)))
.then(
doSomething()
});
})
.catch(err)
function convertItemsl (job){
return myApi.getItem(job.id).then( response => {
const name = response.name ? response.name : ‘’;
return {
name: name,
status: job.status
};
}
)
}
API call:
getItem(){
return super.get('jobs').then(res => res.json());
}
The problem I am experiencing is, there are expected cases where the Api will return not found on some calls.
After all calls to the Api as per array , I would like to continue and return the mapped objects regardless.