mirror of
https://github.com/Radiquum/AniX.git
synced 2025-09-06 06:23:53 +05:00
anix/feat: add wathing now and collections of the week to discovery page
This commit is contained in:
parent
b25bb4d6e9
commit
05cb74b7f2
9 changed files with 74 additions and 32 deletions
25
app/components/Discovery/WatchingNowCarousel.tsx
Normal file
25
app/components/Discovery/WatchingNowCarousel.tsx
Normal file
|
@ -0,0 +1,25 @@
|
|||
"use client";
|
||||
|
||||
import { ENDPOINTS } from "#/api/config";
|
||||
import { useSWRfetcher } from "#/api/utils";
|
||||
import { useUserStore } from "#/store/auth";
|
||||
import { ReleaseCourusel } from "../ReleaseCourusel/ReleaseCourusel";
|
||||
import useSWR from "swr";
|
||||
|
||||
export const WatchingNowCarousel = () => {
|
||||
const token = useUserStore((state) => state.token);
|
||||
const { data, isLoading, error } = useSWR(
|
||||
`${ENDPOINTS.discover.watching}/0${token ? `?token=${token}` : ""}`,
|
||||
useSWRfetcher,
|
||||
{
|
||||
revalidateOnFocus: false,
|
||||
revalidateIfStale: false,
|
||||
revalidateOnReconnect: false,
|
||||
}
|
||||
);
|
||||
|
||||
if (error) return <></>;
|
||||
if (isLoading) return <></>;
|
||||
|
||||
return <ReleaseCourusel content={data.content} sectionTitle={"Смотрят сейчас"} showAllLink={"/discovery/watching"} />;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue