Skip to content

Instantly share code, notes, and snippets.

@jsrath
Last active November 2, 2018 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsrath/dcd60fc460af2907dde906298a11c1df to your computer and use it in GitHub Desktop.
Save jsrath/dcd60fc460af2907dde906298a11c1df to your computer and use it in GitHub Desktop.
Promise.all([
fetch('/api/movies', {
headers: new Headers({
'ApiKey': 'USER_KEY_2',
}),
}),
fetch('/api/series', {
headers: new Headers({
'ApiKey': 'USER_KEY_2',
}),
}),
])
.then(([res1, res2]) => Promise.all([res1.json(), res2.json()]))
.then(([movies, series]) =>
this.setState({
Individual: [...movies.items, ...series.items],
}),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment