Skip to content

Instantly share code, notes, and snippets.

@bdunn313
Created May 30, 2017 02:54
Show Gist options
  • Save bdunn313/2cf3b64b3501acf72cfc4cb53c196a19 to your computer and use it in GitHub Desktop.
Save bdunn313/2cf3b64b3501acf72cfc4cb53c196a19 to your computer and use it in GitHub Desktop.
// Fancy new function syntax
fakeNetworkCall('/api/endpoint/1/')
.then(result => fakeNetworkCall('/api/endpoint/2/'))
.then(result => fakeNetworkCall('/api/endpoint/3/'))
// Maybe we finally call a render method on our last request?
.then(result => renderToPage(result))
// Make sure any errors are caught.
.catch(error => handleError(error))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment