diff --git a/src/features/Courses/AddClass/index.jsx b/src/features/Courses/AddClass/index.jsx index 206bd14..c0c5487 100644 --- a/src/features/Courses/AddClass/index.jsx +++ b/src/features/Courses/AddClass/index.jsx @@ -1,6 +1,5 @@ import React, { useEffect, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import { useParams } from 'react-router-dom'; import PropTypes from 'prop-types'; import { @@ -23,7 +22,6 @@ import 'features/Courses/AddClass/index.scss'; const AddClass = ({ isOpen, onClose, courseInfo, isCoursePage, isEditing, isDetailClassPage, }) => { - const { courseName } = useParams(); const dispatch = useDispatch(); const selectedInstitution = useSelector((state) => state.main.selectedInstitution); const instructorsList = useSelector((state) => state.instructors.selectOptions.data); @@ -37,8 +35,6 @@ const AddClass = ({ const [startDate, setStartDate] = useState(''); const [endDate, setEndDate] = useState(''); - const courseNameDecoded = courseName ? decodeURIComponent(courseName) : ''; - const handleAddClass = async (e) => { e.preventDefault(); const form = e.target; @@ -61,9 +57,9 @@ const AddClass = ({ logError(error); } finally { if (isDetailClassPage) { - dispatch(fetchAllClassesData(selectedInstitution.id, courseNameDecoded)); + dispatch(fetchAllClassesData(selectedInstitution.id, courseInfo.masterCourseId)); } else { - dispatch(fetchClassesData(selectedInstitution.id, initialPage, courseNameDecoded)); + dispatch(fetchClassesData(selectedInstitution.id, initialPage, courseInfo.masterCourseId)); dispatch(updateClassesCurrentPage(initialPage)); } } @@ -87,7 +83,7 @@ const AddClass = ({ dispatch(fetchCoursesData(selectedInstitution.id, initialPage)); dispatch(updateCoursesCurrentPage(initialPage)); } else { - dispatch(fetchClassesData(selectedInstitution.id, initialPage, courseNameDecoded)); + dispatch(fetchClassesData(selectedInstitution.id, initialPage, courseInfo.masterCourseId)); dispatch(updateClassesCurrentPage(initialPage)); } }