Created
January 17, 2017 20:15
-
-
Save areichman/ecd1cc1bfd5afab407b5f20ea3928dac to your computer and use it in GitHub Desktop.
ES6 fetch
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
fetch(url, {credentials: 'include'}) | |
.then((response) => { | |
if (response.ok) { | |
response.json().then(fetchSuccess); | |
} else { | |
response.json().then(fetchError); | |
} | |
}).catch(fetchError); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment