Skip to content

Commit

Permalink
refactor(www): get github stars
Browse files Browse the repository at this point in the history
  • Loading branch information
alifarooq9 committed Apr 9, 2024
1 parent 2bb6ae7 commit b76a671
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
22 changes: 21 additions & 1 deletion apps/www/src/app/(app)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { siteUrls } from "@/config/urls";
import { buttonVariants } from "@/components/ui/button";
import { Icons } from "@/components/icons";
import { HighlightTabs } from "@/app/(app)/_components/highlight-tabs";
import { getRepoStars } from "@/server/actions/github";

export default async function HomePage() {
const repoStars = await getRepoStars();
Expand Down Expand Up @@ -66,3 +65,24 @@ export default async function HomePage() {
</div>
);
}

export async function getRepoStars() {
const response = await fetch(
"https://api.github.com/repos/afarooq-oss/rapidlaunch",
{
next: {
revalidate: 86400,
},
},
);

const data: unknown = await response.json();
const stars: number = (data as { stargazers_count?: string })
?.stargazers_count
? Number((data as { stargazers_count?: string }).stargazers_count)
: 0;

console.log(data);

return stars;
}
20 changes: 0 additions & 20 deletions apps/www/src/server/actions/github.ts

This file was deleted.

0 comments on commit b76a671

Please sign in to comment.