Skip to content

Commit

Permalink
Rename github client
Browse files Browse the repository at this point in the history
  • Loading branch information
mhasanince committed Nov 9, 2023
1 parent 8b60213 commit fd2c1a1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/utils/api-client.ts → src/utils/github-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ const get = async (url: string) => {
}
};

export const apiClient = {
export const githubClient = {
get,
};
2 changes: 1 addition & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './api-client';
export * from './github-client';
4 changes: 2 additions & 2 deletions src/views/community-projects.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import type { GithubRepo } from '@/types';
import { apiClient } from '@/utils';
import { githubClient } from '@/utils';
import RepoCard from '@/components/repo-card.astro';
Expand Down Expand Up @@ -37,7 +37,7 @@ const PROJECTS = [
const data: Array<GithubRepo> = await Promise.all(
PROJECTS.map(async ({ username, repo }) => {
return apiClient.get(`https://api.github.com/repos/${username}/${repo}`);
return githubClient.get(`https://api.github.com/repos/${username}/${repo}`);
}),
);
---
Expand Down
4 changes: 2 additions & 2 deletions src/views/open-source-projects.astro
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
import type { GithubRepo } from '@/types';
import { apiClient } from '@/utils';
import { githubClient } from '@/utils';
import RepoCard from '@/components/repo-card.astro';
const HIDDEN_REPOS = ['action-send-mail', '.github'];
const data = await apiClient
const data = await githubClient
.get('https://api.github.com/orgs/craftgate/repos')
.then((res: Array<GithubRepo>) =>
res.filter((repo) => !HIDDEN_REPOS.includes(repo.name)),
Expand Down
6 changes: 3 additions & 3 deletions src/views/team.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import type { GithubUser } from '@/types';
import { apiClient } from '@/utils';
import { githubClient } from '@/utils';
import TeamMemberCard from '@/components/team-member-card.astro';
Expand All @@ -11,15 +11,15 @@ const HIDDEN_MEMBERS = [
'ozturkselin',
];
const data = await apiClient
const data = await githubClient
.get('https://api.github.com/orgs/craftgate/members')
.then((res: Array<Omit<GithubUser, 'name'>>) =>
res.filter((member) => !HIDDEN_MEMBERS.includes(member.login)),
)
.then((members) => {
return Promise.all(
members.map(async (member) => {
return apiClient.get(`https://api.github.com/users/${member.login}`);
return githubClient.get(`https://api.github.com/users/${member.login}`);
}),
);
});
Expand Down

0 comments on commit fd2c1a1

Please sign in to comment.