Skip to content

Instantly share code, notes, and snippets.

@allangrds
Created October 26, 2020 20:52
Show Gist options
  • Save allangrds/c939a89183bbbd48b5b535ef37fd6cac to your computer and use it in GitHub Desktop.
Save allangrds/c939a89183bbbd48b5b535ef37fd6cac to your computer and use it in GitHub Desktop.
// axios
axios.get('https://api.github.com/orgs/axios')
.then(response => {
console.log(response.data);
}, error => {
console.log(error);
});
// fetch()
fetch('https://api.github.com/orgs/axios')
.then(response => response.json()) // passo extra
.then(data => {
console.log(data)
})
.catch(error => console.error(error));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment