Skip to content

Commit

Permalink
fix: use URL Web API
Browse files Browse the repository at this point in the history
  • Loading branch information
CMEONE committed Nov 12, 2024
1 parent c5317ae commit fcad471
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/views/lib/getGitHubStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,12 @@ export class GitHubStatsService {

private async fetchGitHub(route: string): Promise<unknown> {
try {
const response = await fetch(`https://github.cachedapi.com${route}`);
const url = new URL(route, 'https://github.cachedapi.com');
const response = await fetch(url);
return await response.json();
} catch (error: unknown) {
const response = await fetch(`https://api.github.com${route}`);
const url = new URL(route, 'https://api.github.com');
const response = await fetch(url);
return await response.json();
}
}
Expand Down

0 comments on commit fcad471

Please sign in to comment.