Ошибка
Произошла ошибка при загрузке закладок. Попробуйте обновить страницу или зайдите позже.
"use client"; import useSWRInfinite from "swr/infinite"; import { ReleaseSection } from "#/components/ReleaseSection/ReleaseSection"; import { Spinner } from "#/components/Spinner/Spinner"; import { useState, useEffect } from "react"; import { useScrollPosition } from "#/hooks/useScrollPosition"; import { useUserStore } from "../store/auth"; import { Button, ButtonGroup, Dropdown, DropdownItem } from "flowbite-react"; import { sort } from "./common"; import { ENDPOINTS } from "#/api/config"; import { BookmarksList, useSWRfetcher } from "#/api/utils"; import { useRouter } from "next/navigation"; const DropdownTheme = { floating: { target: "w-fit md:min-w-[256px]", }, }; export function BookmarksCategoryPage(props: any) { const token = useUserStore((state) => state.token); const authState = useUserStore((state) => state.state); const [selectedSort, setSelectedSort] = useState(0); const [searchVal, setSearchVal] = useState(""); const router = useRouter(); const getKey = (pageIndex: number, previousPageData: any) => { if (previousPageData && !previousPageData.content.length) return null; let url: string; if (props.profile_id) { url = `${ENDPOINTS.user.bookmark}/all/${props.profile_id}/${ BookmarksList[props.slug] }/${pageIndex}?sort=${sort.values[selectedSort].id}`; if (token) { url += `&token=${token}`; } } else { if (token) { url = `${ENDPOINTS.user.bookmark}/all/${ BookmarksList[props.slug] }/${pageIndex}?sort=${sort.values[selectedSort].id}&token=${token}`; } } return url; }; const { data, error, isLoading, size, setSize } = useSWRInfinite( getKey, useSWRfetcher, { initialSize: 2 } ); const [content, setContent] = useState(null); useEffect(() => { if (data) { let allReleases = []; for (let i = 0; i < data.length; i++) { allReleases.push(...data[i].content); } setContent(allReleases); } }, [data]); const scrollPosition = useScrollPosition(); useEffect(() => { if (scrollPosition >= 98 && scrollPosition <= 99) { setSize(size + 1); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [scrollPosition]); useEffect(() => { if (authState === "finished" && !token && !props.profile_id) { router.push(`/login?redirect=/bookmarks/${props.slug}`); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [authState, token]); if (isLoading) { return (
Произошла ошибка при загрузке закладок. Попробуйте обновить страницу или зайдите позже.
В списке {props.SectionTitleMapping[props.slug]} пока ничего нет...