Skip to content

Commit

Permalink
Merge branch 'master' into home
Browse files Browse the repository at this point in the history
  • Loading branch information
aish2002 committed Sep 4, 2021
2 parents f976e39 + 7163390 commit 6a9d772
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/api/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import axios from 'axios';

const getUsers = async (nam) => {
try{
return await axios.get("https://api.github.com/users/"+ nam);
}
catch(err){
console.log("User API call not complete");
}
};

let repo=[];


const getRepos = async (nam) => {
try{
const repos= await axios.get("https://api.github.com/users/"+nam+"/repos");
repos.data.map(async (ele)=>{

const lang = await axios.get(ele.languages_url);
// console.log(lang);
repo.push({
name:ele.full_name,
lang:lang.data,
stargazer_count:ele.stargazers_count
});
})
// console.log(repo);
return repo;
}
catch(err){
console.log("Repos API call not complete");
}

};

export {getUsers, getRepos};

0 comments on commit 6a9d772

Please sign in to comment.