diff --git a/src/features/Instructors/InstructorsPage/index.jsx b/src/features/Instructors/InstructorsPage/index.jsx index 6f8f3845..79273716 100644 --- a/src/features/Instructors/InstructorsPage/index.jsx +++ b/src/features/Instructors/InstructorsPage/index.jsx @@ -21,13 +21,19 @@ const InstructorsPage = () => { useEffect(() => { if (Object.keys(selectedInstitution).length > 0) { - dispatch(fetchInstructorsData(selectedInstitution.id, currentPage, stateInstructors.filters)); + dispatch(fetchInstructorsData(selectedInstitution.id, initialPage)); } return () => { dispatch(resetInstructorsRequest()); }; - }, [selectedInstitution, dispatch, currentPage]); // eslint-disable-line react-hooks/exhaustive-deps + }, [selectedInstitution, dispatch]); // eslint-disable-line react-hooks/exhaustive-deps + + useEffect(() => { + if (Object.keys(selectedInstitution).length > 0) { + dispatch(fetchInstructorsData(selectedInstitution.id, currentPage, stateInstructors.filters)); + } + }, [currentPage]); // eslint-disable-line react-hooks/exhaustive-deps const handlePagination = (targetPage) => { setCurrentPage(targetPage); diff --git a/src/features/Licenses/LicensesFilters/index.jsx b/src/features/Licenses/LicensesFilters/index.jsx index d139364a..e29e6743 100644 --- a/src/features/Licenses/LicensesFilters/index.jsx +++ b/src/features/Licenses/LicensesFilters/index.jsx @@ -34,14 +34,11 @@ const LicensesFilters = ({ resetPagination }) => { const form = e.target; const formData = new FormData(form); const formJson = Object.fromEntries(formData.entries()); - const urlParamsFilters = Object.entries(formJson) - .map(([key, value]) => `${key}=${encodeURIComponent(value)}`) - .join('&'); try { dispatch(updateFilters(formJson)); dispatch(updateCurrentPage(initialPage)); - dispatch(fetchLicensesData(institution.id, initialPage, urlParamsFilters)); + dispatch(fetchLicensesData(institution.id, initialPage, formJson)); } catch (error) { logError(error); } diff --git a/src/features/Licenses/LicensesPage/index.jsx b/src/features/Licenses/LicensesPage/index.jsx index 6eb1ccd2..c7219c17 100644 --- a/src/features/Licenses/LicensesPage/index.jsx +++ b/src/features/Licenses/LicensesPage/index.jsx @@ -25,11 +25,17 @@ const LicensesPage = () => { useEffect(() => { if (Object.keys(selectedInstitution).length > 0) { - dispatch(fetchLicensesData(selectedInstitution?.id, currentPage, stateLicenses.filters)); + dispatch(fetchLicensesData(selectedInstitution.id, initialPage)); } return () => dispatch(resetLicensesTable()); - }, [selectedInstitution, dispatch, currentPage]); // eslint-disable-line react-hooks/exhaustive-deps + }, [selectedInstitution, dispatch]); // eslint-disable-line react-hooks/exhaustive-deps + + useEffect(() => { + if (Object.keys(selectedInstitution).length > 0) { + dispatch(fetchLicensesData(selectedInstitution.id, currentPage, stateLicenses.filters)); + } + }, [currentPage]); // eslint-disable-line react-hooks/exhaustive-deps return ( diff --git a/src/features/Students/StudentsPage/index.jsx b/src/features/Students/StudentsPage/index.jsx index 548678de..87cd5387 100644 --- a/src/features/Students/StudentsPage/index.jsx +++ b/src/features/Students/StudentsPage/index.jsx @@ -17,7 +17,7 @@ const StudentsPage = () => { useEffect(() => { if (Object.keys(selectedInstitution).length > 0) { - dispatch(fetchStudentsData(selectedInstitution.id, currentPage, stateStudents.filters)); + dispatch(fetchStudentsData(selectedInstitution.id, initialPage)); } return () => { @@ -25,6 +25,12 @@ const StudentsPage = () => { }; }, [selectedInstitution, dispatch]); // eslint-disable-line react-hooks/exhaustive-deps + useEffect(() => { + if (Object.keys(selectedInstitution).length > 0) { + dispatch(fetchStudentsData(selectedInstitution.id, currentPage, stateStudents.filters)); + } + }, [currentPage]); // eslint-disable-line react-hooks/exhaustive-deps + const resetPagination = () => { setCurrentPage(initialPage); };