Skip to content

Commit

Permalink
fix: github stars count (#1970)
Browse files Browse the repository at this point in the history
Co-authored-by: Julius Marminge <julius0216@outlook.com>
  • Loading branch information
dipanshurdev and juliusmarminge authored Oct 3, 2024
1 parent 4885a97 commit 33d9574
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions www/src/components/navigation/githubIcon.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,24 @@
import { getIsRtlFromUrl, getLanguageFromURL } from "../../languages";
import { fetchGithub } from "../../utils/fetchGithub";
let githubStars = 23000;
let githubStars = 25000;
try {
(await fetchGithub("https://api.github.com/repos/t3-oss/create-t3-app", {
throwIfNoAuth: false,
fetchType: "repo",
}).then((data) => data?.stargazers_count)) ?? 23000;
const fetchedStars = await fetchGithub(
"https://api.github.com/repos/t3-oss/create-t3-app",
{
throwIfNoAuth: false,
fetchType: "repo",
},
).then((data) => data?.stargazers_count);
githubStars = fetchedStars ?? 25000;
} catch (e) {
console.error("unable to fetch from github", e);
}
const ONE_HOUR = 1 * 60 * 60;
Astro.response.headers.set("Cache-Control", `public, max-age=${ONE_HOUR}`);
const { pathname } = Astro.url;
Expand Down

0 comments on commit 33d9574

Please sign in to comment.