Use static assets instead of fetching from github (#156)

This commit is contained in:
Håvard Gjøby Thom
2024-11-09 20:06:54 +01:00
committed by GitHub
parent 2af11d145f
commit d199762427
18 changed files with 136 additions and 107 deletions

View File

@@ -1,10 +1,10 @@
import { basePath } from "@/config/siteConfig";
import { cn } from "@/lib/utils";
import Link from "next/link";
import { useEffect, useState } from "react";
import { FaGithub, FaStar } from "react-icons/fa";
import NumberTicker from "./number-ticker";
import { buttonVariants } from "./button";
import { basePath } from "@/config/siteConfig";
import NumberTicker from "./number-ticker";
export default function StarOnGithubButton() {
const [stars, setStars] = useState(0);
@@ -12,9 +12,12 @@ export default function StarOnGithubButton() {
useEffect(() => {
const fetchStars = async () => {
try {
const res = await fetch(`https://api.github.com/repos/community-scripts/${basePath}`, {
next: { revalidate: 60 * 60 * 24 },
});
const res = await fetch(
`https://api.github.com/repos/community-scripts/${basePath}`,
{
next: { revalidate: 60 * 60 * 24 },
},
);
if (res.ok) {
const data = await res.json();