Reputation: 3875
Unless I'm mistaken, I would like to get the values from 3 different promises and use what they return to call a function. I tried looking at chaining promises and Promise.all but I don't think that solves what I'm looking for?
What I would like to do is something like this:
somePromise( someParam ) => ( someReturnObj1 => {
});
somePromise2( someParam ) => ( someReturnObj2 => {
});
somePromise3( someParam ) => ( someReturnObj3 => {
});
// I would like to call this after getting all the data from those 3 promises
callSomeFunc( someReturnObj1, someReturnObj2, someReturnObj3 );
Is this possible?
Upvotes: 1
Views: 46
Reputation: 118
Try this:
Promise.all([promise1,promise2]).then(result => {
resultFromPromise1 = result[0];
resultFromPromise2 = result[1];
});
Upvotes: 4