mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-06-10 07:16:01 +00:00
20 lines
457 B
TypeScript
20 lines
457 B
TypeScript
export async function fetchGitHubStats(): Promise<{
|
|
stars: number;
|
|
forks: number;
|
|
}> {
|
|
try {
|
|
const res = await fetch(
|
|
"https://api.github.com/repos/felipegcoutinho/openmonetis",
|
|
{ next: { revalidate: 3600 } },
|
|
);
|
|
if (!res.ok) return { stars: 200, forks: 60 };
|
|
const data = await res.json();
|
|
return {
|
|
stars: data.stargazers_count as number,
|
|
forks: data.forks_count as number,
|
|
};
|
|
} catch {
|
|
return { stars: 200, forks: 60 };
|
|
}
|
|
}
|