Created
February 23, 2021 06:34
-
-
Save sabesansathananthan/79d353fc26e265502567c56c3a7887ed to your computer and use it in GitHub Desktop.
Axios Vs 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
axios.all([ | |
axios.get('https://api.github.com/users/sabesansathananthan'), | |
axios.get('https://api.github.com/users/rcvaram') | |
]) | |
.then(axios.spread((obj1, obj2) => { | |
// Both requests are now complete | |
console.log(obj1.data.login + ' has ' + obj1.data.public_repos + ' public repos on GitHub'); | |
console.log(obj2.data.login + ' has ' + obj2.data.public_repos + ' public repos on GitHub'); | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment