Created
January 27, 2019 21:31
-
-
Save 0GiS0/b2222cbedc9b184809edb927548b19d5 to your computer and use it in GitHub Desktop.
Fetch and async working together
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
const repos = async(loginName) => { | |
try { | |
var response = await fetch(`https://api.github.com/users/${loginName}/repos`); | |
var json = await response.json(); | |
var followerList = json.map(repo => repo.name); | |
console.log(followerList); | |
} catch (error) { | |
console.log(`Error: ${error}`); | |
} | |
}; | |
repos('0gis0'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment