"use client"; import useSWR from "swr"; import { ReleaseCourusel } from "./components/ReleaseCourusel/ReleaseCourusel"; const fetcher = (...args) => fetch(...args).then((res) => res.json()); function fetchReleases(status) { const { data, error, isLoading } = useSWR( `/api/home?status=${status}`, fetcher ); return [data, error, isLoading]; } export default function Home() { const [lastReleasesData, lastReleasesError, lastReleasesIsLoading] = fetchReleases("last"); const [ finishedReleasesData, finishedReleasesError, finishedReleasesIsLoading, ] = fetchReleases("finished"); const [ongoingReleasesData, ongoingReleasesError, ongoingReleasesIsLoading] = fetchReleases("ongoing"); const [ announceReleasesData, announceReleasesError, announceReleasesIsLoading, ] = fetchReleases("announce"); return (
{lastReleasesData && ( )} {finishedReleasesData && ( )} {ongoingReleasesData && ( )} {announceReleasesData && ( )}
); }