Skip to content

Commit

Permalink
Don't over-promise with your code.
Browse files Browse the repository at this point in the history
  • Loading branch information
philnash committed Feb 12, 2017
1 parent 60201a0 commit ea38977
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions _posts/2017-02-09-toast-to-es2015-destructuring.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ Let's take a look at the code:
const deadPonyClubUrl = "https://api.punkapi.com/v2/beers/91"; const deadPonyClubUrl = "https://api.punkapi.com/v2/beers/91";
const punkAPIPromise = fetch(punkAPIUrl) const punkAPIPromise = fetch(punkAPIUrl)
.then(res => res.json()) .then(res => res.json())
.then(data => Promise.resolve(data[0])); .then(data => data[0]);
const deadPonyClubPromise = fetch(deadPonyClubUrl) const deadPonyClubPromise = fetch(deadPonyClubUrl)
.then(res => res.json()) .then(res => res.json())
.then(data => Promise.resolve(data[0])); .then(data => data[0]);


Promise.all([punkAPIPromise, deadPonyClubPromise]) Promise.all([punkAPIPromise, deadPonyClubPromise])
.then(beers => { .then(beers => {
Expand Down

0 comments on commit ea38977

Please sign in to comment.