Last active
June 12, 2017 14:43
-
-
Save patarkf/86e89b72e0e28afd8fb52f2e703c4784 to your computer and use it in GitHub Desktop.
Promise request example
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
function getFromGitHub() { | |
const userName = 'patarkf'; | |
const url = 'https://api.github.com/users'; | |
fetch(`${url}/${userName}/repos`) | |
.then(reposResponse => { | |
return reposResponse.json(); | |
}) | |
.then(userRepos => { | |
console.log(userRepos); | |
}) | |
.catch(err => { | |
console.log(err); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment