Last active
June 13, 2019 08:32
-
-
Save minedun6/abff578e542c3e312b0b55e902e58a7b to your computer and use it in GitHub Desktop.
Multiple api calls
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// props to Mathias Bynens @mathias (twitter) | |
const promises = [ | |
fetch('/api-call-1'), | |
fetch('/api-call-2'), | |
fetch('/api-call-3') | |
]; | |
// imagine some of these requests fail and some succeed. | |
await Promise.allSettled(promises); | |
// All API calls have finished (either failed or succeeded). | |
removeLoadingIndicator(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment