diff --git a/backend/modules/pages/favorites.py b/backend/modules/pages/favorites.py
index 68c3dde..e90e852 100644
--- a/backend/modules/pages/favorites.py
+++ b/backend/modules/pages/favorites.py
@@ -9,7 +9,7 @@ router = APIRouter()
@router.get("", summary="Get user favorites list")
async def GetUserFavorites(request: Request, token: str, page: int = 0):
return await apiRequest(
- request, ENDPOINTS["user"]["favorite"], f"/all/{page}", query=f"?token={token}"
+ request, ENDPOINTS["user"]["favorite"], f"all/{page}", query=f"?token={token}"
)
@@ -18,7 +18,7 @@ async def addReleaseToFavorites(request: Request, release_id: int, token: str):
return await apiRequest(
request,
ENDPOINTS["user"]["favorite"],
- f"/add/{release_id}",
+ f"add/{release_id}",
query=f"?token={token}",
)
@@ -28,6 +28,6 @@ async def deleteReleaseFromFavorites(request: Request, release_id: int, token: s
return await apiRequest(
request,
ENDPOINTS["user"]["favorite"],
- f"/delete/{release_id}",
+ f"delete/{release_id}",
query=f"?token={token}",
)
diff --git a/frontend/app/api/config.js b/frontend/app/api/config.js
index 71a135c..f099a3a 100644
--- a/frontend/app/api/config.js
+++ b/frontend/app/api/config.js
@@ -20,6 +20,7 @@ export const endpoints = {
delayed: `${API_URL}/bookmarks/delayed`,
abandoned: `${API_URL}/bookmarks/abandoned`,
},
+ favorites: `${API_URL}/favorites`,
},
release: `${API_URL}/release`,
};
diff --git a/frontend/app/components/NavigationRail/NavigationRail.jsx b/frontend/app/components/NavigationRail/NavigationRail.jsx
index 97ae4a5..9a4d58f 100644
--- a/frontend/app/components/NavigationRail/NavigationRail.jsx
+++ b/frontend/app/components/NavigationRail/NavigationRail.jsx
@@ -27,13 +27,13 @@ export const NavigationRail = (props) => {
icon: "bookmark",
path: "/bookmarks",
},
- //
- // {
- // title: "Избранное",
- // icon: "favorite",
- // path: "/favorites",
- // },
- //
+
+ {
+ title: "Избранное",
+ icon: "favorite",
+ path: "/favorites",
+ },
+
{
title: "История",
icon: "history",
diff --git a/frontend/app/favorites/page.js b/frontend/app/favorites/page.js
new file mode 100644
index 0000000..be6ea5c
--- /dev/null
+++ b/frontend/app/favorites/page.js
@@ -0,0 +1,70 @@
+"use client";
+
+import { LogInNeeded } from "@/app/components/LogInNeeded/LogInNeeded";
+import ReleasesOverview from "../components/ReleasesOverview/ReleasesOverview";
+import { useUserStore } from "@/app/store/user-store";
+import { endpoints } from "../api/config";
+import { useEffect, useState } from "react";
+import { getData } from "../api/api-utils";
+
+export default function History() {
+ const userStore = useUserStore();
+
+ const [releases, setReleases] = useState();
+ const [page, setPage] = useState(0);
+
+ const [isNextPage, setIsNextPage] = useState(true);
+
+ async function fetchData(page = 0) {
+ if (userStore.token) {
+ const url = `${endpoints.user.favorites}?page=${page}&token=${userStore.token}`;
+ const data = await getData(url);
+
+ if (data.content.length < 25) {
+ setIsNextPage(false);
+ } else {
+ setIsNextPage(true);
+ }
+
+ // Handle initial load (page 0) or subsequent pagination
+ if (page === 0) {
+ setReleases(data.content);
+ } else {
+ setReleases([...releases, ...data.content]);
+ }
+ }
+ }
+
+ useEffect(() => {
+ fetchData();
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [userStore]);
+
+ useEffect(() => {
+ if (releases) {
+ fetchData(page); // Use fetchData for pagination
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [page]);
+
+ return (
+ <>
+ {!userStore.isAuth ? (
+
Добавьте любимое аниме, что бы его не потерять.
+