From be59fa12aad56d0b2a4a6b7108064f32660a7744 Mon Sep 17 00:00:00 2001 From: Ruidy Date: Tue, 2 Jun 2020 13:44:23 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=99=20Fetch=20GitHub=20Repos=20(#14)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- src/services/github/index.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/services/github/index.ts b/src/services/github/index.ts index 98dc454..1f733dc 100644 --- a/src/services/github/index.ts +++ b/src/services/github/index.ts @@ -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);