Currently, I expect all promises to end as follows:
(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 in this way, the profile and token are executed sequentially. Since both of them are independent of each other, I want both of them to be executed independently of each other. I think this can be done using Promise.all, but I am not sure of the syntax, and I also did not find any help.
So my question is how can I convert over api calls to work together and then return the final output.
source
share