From cfef5f0a16a13e4b2e25a4395327557a5a627ae6 Mon Sep 17 00:00:00 2001 From: stCarolas Date: Sun, 16 Jun 2024 19:59:09 +0300 Subject: [PATCH] fix using testuser as recipientId for historyPage --- src/pages/History/HistoryPage.tsx | 41 +++++++++++++++++-------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/pages/History/HistoryPage.tsx b/src/pages/History/HistoryPage.tsx index a7cddeb..d368b58 100644 --- a/src/pages/History/HistoryPage.tsx +++ b/src/pages/History/HistoryPage.tsx @@ -8,6 +8,8 @@ import { } from "@opendonationassistant/oda-history-service-client"; import { usePagination } from "ahooks"; import { PaginationResult } from "ahooks/lib/usePagination/types"; +import { useLoaderData } from "react-router"; +import { WidgetData } from "../../types/WidgetData"; const dateTimeFormat = new Intl.DateTimeFormat("ru-RU", { year: "numeric", @@ -63,22 +65,6 @@ function description(item: HistoryItemData) { return desc; } -async function getHistory(params: { - current: number; - pageSize: number; -}): Promise<{ total: number; list: HistoryItemData[] }> { - const history = await HistoryService( - undefined, - process.env.REACT_APP_HISTORY_API_ENDPOINT, - ).getHistory( - { - recipientId: "testuser", - }, - { params: { size: params.pageSize, page: params.current - 1 } }, - ); - return { total: history.data.totalSize, list: history.data?.content }; -} - function list(data: HistoryItemData[], pagination: any) { return ( { + const history = await HistoryService( + undefined, + process.env.REACT_APP_HISTORY_API_ENDPOINT, + ).getHistory( + { + recipientId: recipientId, + }, + { params: { size: params.pageSize, page: params.current - 1 } }, + ); + return { total: history.data.totalSize, list: history.data?.content }; + } return ( <>