Skip to content

Instantly share code, notes, and snippets.

@minedun6
Last active June 13, 2019 08:32
Show Gist options
  • Save minedun6/abff578e542c3e312b0b55e902e58a7b to your computer and use it in GitHub Desktop.
Save minedun6/abff578e542c3e312b0b55e902e58a7b to your computer and use it in GitHub Desktop.
Multiple api calls
// 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