Commit cd057e9d by jaymehta

paginationissue

1 parent 952ec4d9
...@@ -20,7 +20,7 @@ const ListingItems = ({ allActivitiesData, loading, gridClass, totalCount }) => ...@@ -20,7 +20,7 @@ const ListingItems = ({ allActivitiesData, loading, gridClass, totalCount }) =>
// }, [router]); // }, [router]);
console.log("endUser", endUser); console.log("endUser", endUser);
// console.log("router", router); // console.log("router", router);
let { page = 1, location = "" } = router.query; let { page, location = "" } = router.query;
page = Number(page); page = Number(page);
let queryParams; let queryParams;
...@@ -39,6 +39,8 @@ const ListingItems = ({ allActivitiesData, loading, gridClass, totalCount }) => ...@@ -39,6 +39,8 @@ const ListingItems = ({ allActivitiesData, loading, gridClass, totalCount }) =>
} else { } else {
queryParams.append("page", pageNumber); queryParams.append("page", pageNumber);
} }
dispatch(getActivitiesByFilters({ currentPage: e }));
router.replace({ router.replace({
search: queryParams.toString() search: queryParams.toString()
}); });
...@@ -120,8 +122,6 @@ const ListingItems = ({ allActivitiesData, loading, gridClass, totalCount }) => ...@@ -120,8 +122,6 @@ const ListingItems = ({ allActivitiesData, loading, gridClass, totalCount }) =>
onChange={async (e) => { onChange={async (e) => {
console.log("log >",e); console.log("log >",e);
await handlePagination(e); await handlePagination(e);
dispatch(getActivitiesByFilters({ currentPage: e }));
}} }}
nextPageText={"›"} nextPageText={"›"}
prevPageText={"‹"} prevPageText={"‹"}
......
...@@ -441,6 +441,8 @@ export const getActivitiesByFilters = ...@@ -441,6 +441,8 @@ export const getActivitiesByFilters =
}; };
if (currentPage) { if (currentPage) {
query.pagination["page"] = Number(currentPage); query.pagination["page"] = Number(currentPage);
} else {
query.pagination["page"] = 1;
} }
console.log("page query", query); console.log("page query", query);
if (category) { if (category) {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!