Skip to content

Instantly share code, notes, and snippets.

@jaydson
Created March 8, 2021 16:49
Show Gist options
  • Save jaydson/30139e6efd5488b909966813ec971ae4 to your computer and use it in GitHub Desktop.
Save jaydson/30139e6efd5488b909966813ec971ae4 to your computer and use it in GitHub Desktop.
fetch(URL_TO_FETCH)
.then(response => response.json()) // retorna uma promise
.then(result => {
console.log(result);
})
.catch(err => {
// trata se alguma das promises falhar
console.error('Failed retrieving information', err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment