forked from CSI-KJSCE/appointment_to_examiner
filterpage render fixed
This commit is contained in:
@@ -6,7 +6,7 @@ import Navbar from "./Navbar";
|
||||
import { toast, ToastContainer } from "react-toastify";
|
||||
import "react-toastify/dist/ReactToastify.css";
|
||||
|
||||
const FilterPage = () => {
|
||||
const FilterPage = ({ setCourses }) => {
|
||||
const currentYear = new Date().getFullYear();
|
||||
|
||||
// Load saved filters from localStorage or set default values
|
||||
@@ -53,12 +53,18 @@ const FilterPage = () => {
|
||||
JSON.stringify(filteredCourses)
|
||||
);
|
||||
|
||||
// Update courses if setCourses is passed as a prop (from CourseTable)
|
||||
if (setCourses) {
|
||||
setCourses(filteredCourses);
|
||||
} else {
|
||||
// Navigate to the courses page without updating the parent state
|
||||
navigate("/courses", {
|
||||
state: {
|
||||
courses: filteredCourses,
|
||||
academicYear: formData.academicYear,
|
||||
},
|
||||
});
|
||||
}
|
||||
} else {
|
||||
toast.error("No courses found for the selected filters.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user