fix: React Hook "useSWR" is called in function "fetchReleases" while build

This commit is contained in:
Kentai Radiquum 2024-07-13 10:09:08 +05:00
parent 6df90d5146
commit 4d1d923cd1
Signed by: Radiquum
GPG key ID: 858E8EE696525EED

View file

@ -4,16 +4,16 @@ import { ReleaseCourusel } from "./components/ReleaseCourusel/ReleaseCourusel";
import { Spinner } from "./components/Spinner/Spinner";
const fetcher = (...args) => fetch(...args).then((res) => res.json());
function fetchReleases(status) {
const { data } = useSWR(`/api/home?status=${status}`, fetcher);
return [data];
}
export default function Home() {
const [lastReleasesData] = fetchReleases("last");
const [finishedReleasesData] = fetchReleases("finished");
const [ongoingReleasesData] = fetchReleases("ongoing");
const [announceReleasesData] = fetchReleases("announce");
function useFetchReleases(status) {
const { data } = useSWR(`/api/home?status=${status}`, fetcher);
return [data];
}
const [lastReleasesData] = useFetchReleases("last");
const [finishedReleasesData] = useFetchReleases("finished");
const [ongoingReleasesData] = useFetchReleases("ongoing");
const [announceReleasesData] = useFetchReleases("announce");
return (
<main className="flex flex-col pt-2 pb-16 sm:pt-4 sm:pb-0">