feat: add release user list and release user favorite to the ReleaseLink on Index and Index Category pages

This commit is contained in:
Kentai Radiquum 2024-07-14 14:35:02 +05:00
parent c4a9b4f91a
commit 35c79559ab
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
5 changed files with 68 additions and 22 deletions

View file

@ -3,10 +3,20 @@ 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 IndexPage() {
const userStore = useUserStore((state) => state);
const token = userStore.token;
function useFetchReleases(status) {
const { data } = useSWR(`/api/home?status=${status}`, fetcher);
let url;
url = `/api/home?status=${status}`;
if (token) {
url += `&token=${token}`;
}
const { data } = useSWR(url, fetcher);
return [data];
}