anix/feat: add wathing now and collections of the week to discovery page

This commit is contained in:
Kentai Radiquum 2025-08-25 17:55:51 +05:00
parent b25bb4d6e9
commit 05cb74b7f2
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
9 changed files with 74 additions and 32 deletions

View file

@ -0,0 +1,31 @@
"use client";
import { ENDPOINTS } from "#/api/config";
import { useSWRfetcher } from "#/api/utils";
import useSWR from "swr";
import { CollectionCourusel } from "../CollectionCourusel/CollectionCourusel";
import { useUserStore } from "#/store/auth";
export const CollectionsOfTheWeek = () => {
const token = useUserStore((state) => state.token);
const { data, isLoading, error } = useSWR(
`${ENDPOINTS.discover.collections}/-1?previous_page=0&where=2&sort=4${token ? `&token=${token}` : ""}`,
useSWRfetcher,
{
revalidateOnFocus: false,
revalidateIfStale: false,
revalidateOnReconnect: false,
}
);
if (error) return <></>;
if (isLoading) return <></>;
return (
<CollectionCourusel
sectionTitle="Коллекции недели"
showAllLink={`/discovery/collections`}
content={data.content}
/>
);
};