I am currently waiting for all the promise to finish sequentially like this:
(async() => {
let profile = await profileHelper.getUserData(username);
let token = await tokenHelper.getUserToken(username);
console.log(profile);
console.log(token);
return {profile: profile, token: token};
})();
But this way, profile and token executes sequentially. Since both are independent of each other, I want both of them to be executed independently together. I think this can be done using Promise.all, but I am not sure of the syntax and I could not find any help as well.
So my question is how I can convert above api calls to run together and then return the final output.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…