Skip to content

Instantly share code, notes, and snippets.

@0GiS0
Created January 27, 2019 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0GiS0/b2222cbedc9b184809edb927548b19d5 to your computer and use it in GitHub Desktop.
Save 0GiS0/b2222cbedc9b184809edb927548b19d5 to your computer and use it in GitHub Desktop.
Fetch and async working together
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