mirror of
https://github.com/rjNemo/devbook_ts
synced 2026-06-06 02:36:39 +00:00
🐙 Fetch GitHub Repos (#14)
* edit package.json * eslint * fetch git repos * create repo array on fetch * update repo array on profile edit * edit profile presentation * show only public repos * repo link target blank
This commit is contained in:
parent
bd05e6bd5e
commit
be59fa12aa
1 changed files with 11 additions and 8 deletions
|
|
@ -18,14 +18,17 @@ const getGithubRepos = async (owner: string) => {
|
|||
const {data: repos} = await octokit.repos.listForAuthenticatedUser({
|
||||
owner,
|
||||
});
|
||||
const newRepo: Repo[] = repos.map((r: any) => ({
|
||||
url: r.url,
|
||||
stars: r.stargazers_count,
|
||||
forks: r.forks_count,
|
||||
description: r.description,
|
||||
name: r.name,
|
||||
watchers: r.watchers_count,
|
||||
}));
|
||||
|
||||
const newRepo: Repo[] = repos
|
||||
.filter((r: any) => r.private === false)
|
||||
.map((r: any) => ({
|
||||
url: r.html_url,
|
||||
stars: r.stargazers_count,
|
||||
forks: r.forks_count,
|
||||
description: r.description,
|
||||
name: r.name,
|
||||
watchers: r.watchers_count,
|
||||
}));
|
||||
return newRepo;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
|
|
|
|||
Loading…
Reference in a new issue