Skip to content

Commit

Permalink
Wire up activity log pagination in ActivityLogPage
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonkopliku committed Aug 9, 2024
1 parent 6182848 commit 484c7fc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions assets/js/pages/ActivityLogPage/ActivityLogPage.jsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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 (
<>
Expand All @@ -33,6 +36,10 @@ function ActivityLogPage() {
onCloseActivityLogEntryDetails={() =>
setActivityLogDetailModalOpen(false)
}
currentPaginationData={currentPaginationData}
loadActivityLog={(filtersAndPagination) => {
loadActivityLog(filtersAndPagination);
}}
/>
</>
);
Expand Down

0 comments on commit 484c7fc

Please sign in to comment.