I want to construct an object from multiple promise results. The only way to do this is something like this:
const allPromises = await Promise.all(asyncResult1, asyncResult2);
allPromises.then([result1, result2] => {
return {result1, result2};
})
A nicer way (especially when more data is being constructed) would be this, with the major drawback of the async requests happening one after the other.
const result = {
result1: await asyncResult1(),
result2: await asyncResult2(),
}
Is there a better way to construct my object with async data I am waiting for?