Skip to content

Commit 86c79f0

Browse files
stars count now counting private repos
1 parent 50aac4e commit 86c79f0

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/apis/apis.service.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export class APIService {
2020
{
2121
query:
2222
'query GetUserDetails($username: String!) { user(login: $username)' +
23-
'{ name login followers { totalCount } repositories(first: 100, orderBy: {field: STARGAZERS, direction: DESC}, privacy: PUBLIC)' +
24-
'{ nodes { name owner { login } stargazerCount } } } } }',
23+
'{ name login followers { totalCount } repositories(first: 100, orderBy: {field: STARGAZERS, direction: DESC})' +
24+
'{ nodes { name owner { login } isPrivate stargazerCount } } } } }',
2525
variables: {
2626
username: username
2727
}
@@ -33,7 +33,6 @@ export class APIService {
3333
);
3434

3535
if (response.status !== 200) return null;
36-
3736
const data: GithubRepos = response.data;
3837

3938
data.total_stars = data?.data?.user?.repositories?.nodes?.reduce(

src/apis/types.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ interface GithubRepos {
1313
login: string;
1414
};
1515
stargazerCount: number;
16+
isPrivate: boolean;
1617
}[];
1718
};
1819
};

src/widget/widget.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export class WidgetService {
6969
]);
7070

7171
const top_repos = github_data?.data?.user?.repositories?.nodes
72+
?.filter((node) => !node.isPrivate)
7273
?.slice(0, 3)
7374
?.reduce((acc, value) => {
7475
const name =

0 commit comments

Comments
 (0)