"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()); import { useUserStore } from "@/app/store/auth"; export function BookmarksPage() { const token = useUserStore((state) => state.token); function useFetchReleases(list) { let url; url = `/api/bookmarks?list=${list}&token=${token}`; const { data } = useSWR(url, fetcher); return [data]; } const [watchingData] = useFetchReleases("watching"); const [plannedData] = useFetchReleases("planned"); const [watchedData] = useFetchReleases("watched"); const [delayedData] = useFetchReleases("delayed"); const [abandonedData] = useFetchReleases("abandoned"); return (
{!watchingData || !plannedData || !watchedData || !delayedData || !abandonedData ? (
) : ( "" )} {watchingData && watchingData.content && watchingData.content.length > 0 && ( )} {plannedData && plannedData.content && plannedData.content.length > 0 && ( )} {watchedData && watchedData.content && watchedData.content.length > 0 && ( )} {delayedData && delayedData.content && delayedData.content.length > 0 && ( )} {abandonedData && abandonedData.content && abandonedData.content.length > 0 && ( )}
); }