Created
October 26, 2020 20:52
-
-
Save allangrds/c939a89183bbbd48b5b535ef37fd6cac to your computer and use it in GitHub Desktop.
This file contains 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
// 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