From 484c7fc9b2c9e1f4884fa2b5bb3942f38a495553 Mon Sep 17 00:00:00 2001 From: Nelson Kopliku Date: Fri, 9 Aug 2024 15:31:00 +0200 Subject: [PATCH] Wire up activity log pagination in ActivityLogPage --- .../js/pages/ActivityLogPage/ActivityLogPage.jsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/assets/js/pages/ActivityLogPage/ActivityLogPage.jsx b/assets/js/pages/ActivityLogPage/ActivityLogPage.jsx index 9129c4dd3c..2dbafb53fd 100644 --- a/assets/js/pages/ActivityLogPage/ActivityLogPage.jsx +++ b/assets/js/pages/ActivityLogPage/ActivityLogPage.jsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react'; +import React, { useState } from 'react'; import PageHeader from '@common/PageHeader'; import ActivityLogOverview from '@common/ActivityLogOverview'; @@ -10,17 +10,20 @@ function ActivityLogPage() { const [isLoading, setLoading] = useState(true); const [activityLogDetailModalOpen, setActivityLogDetailModalOpen] = useState(false); + const [currentPaginationData, setCurrentPaginationData] = useState({}); - useEffect(() => { - getActivityLog() + const loadActivityLog = (filters) => { + setLoading(true); + getActivityLog(filters) .then((response) => { setActivityLog(response.data?.data ?? []); + setCurrentPaginationData(response.data?.pagination ?? {}); }) .catch(() => setActivityLog([])) .finally(() => { setLoading(false); }); - }, []); + }; return ( <> @@ -33,6 +36,10 @@ function ActivityLogPage() { onCloseActivityLogEntryDetails={() => setActivityLogDetailModalOpen(false) } + currentPaginationData={currentPaginationData} + loadActivityLog={(filtersAndPagination) => { + loadActivityLog(filtersAndPagination); + }} /> );