"use client"; import useSWR from "swr"; import { ReleaseCourusel } from "@/app/components/ReleaseCourusel/ReleaseCourusel"; import { Spinner } from "@/app/components/Spinner/Spinner"; const fetcher = (...args) => fetch(...args).then((res) => res.json()); export function IndexPage() { 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 (
{lastReleasesData ? ( ) : (
)} {finishedReleasesData && ( )} {ongoingReleasesData && ( )} {announceReleasesData && ( )}
); }