From ef36ed77cb9fde759232e39418e6820cfa7d004a Mon Sep 17 00:00:00 2001 From: DDeviak <117632082+DDeviak@users.noreply.github.com> Date: Mon, 2 Sep 2024 02:48:26 +0300 Subject: [PATCH] feat: Reset page and current pages when filter or title changes in StreetcodesTable component --- .../StreetcodesTable/StreetcodesTable.component.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/features/AdminPage/StreetcodesTable/StreetcodesTable.component.tsx b/src/features/AdminPage/StreetcodesTable/StreetcodesTable.component.tsx index 35e9b57a2..ebbb21686 100644 --- a/src/features/AdminPage/StreetcodesTable/StreetcodesTable.component.tsx +++ b/src/features/AdminPage/StreetcodesTable/StreetcodesTable.component.tsx @@ -56,8 +56,14 @@ const StreetcodesTable = () => { const [requestGetAll, setRequestGetAll] = useState(requestDefault); const setRequest = () => { + let page = pageRequest; + if(requestGetAll.Title !== titleRequest || requestGetAll.Filter !== statusRequest) { + setPageRequest(1); + setCurrentPages(1); + page = 1; + } setRequestGetAll({ - Page: pageRequest, + Page: page, Amount: amountRequest, Title: titleRequest === '' ? null : titleRequest, Sort: null,