Skip to content

Instantly share code, notes, and snippets.

@areichman
Created January 17, 2017 20:15
Show Gist options
  • Save areichman/ecd1cc1bfd5afab407b5f20ea3928dac to your computer and use it in GitHub Desktop.
Save areichman/ecd1cc1bfd5afab407b5f20ea3928dac to your computer and use it in GitHub Desktop.
ES6 fetch
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