diff --git a/client/src/Pages/CourseForm.jsx b/client/src/Pages/CourseForm.jsx index a78f3bb..d593359 100644 --- a/client/src/Pages/CourseForm.jsx +++ b/client/src/Pages/CourseForm.jsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from "react"; import { useLocation, useParams, useNavigate } from "react-router-dom"; -import { fetchFaculties, saveAppointment } from "../api"; +import { fetchFaculties, saveAppointment, updateCourseStatus } from "../api"; import "./CourseForm.css"; const CourseForm = () => { @@ -85,7 +85,7 @@ const CourseForm = () => { if (!groupedTasks[assignedFaculty.facultyId]) { groupedTasks[assignedFaculty.facultyId] = { facultyId: assignedFaculty.facultyId, - courseId: course?.id || id, + courseId: course?.courseId || id, tasks: [], }; } @@ -96,6 +96,7 @@ const CourseForm = () => { const payload = Object.values(groupedTasks); // Convert the grouped tasks into an array console.log("Saving appointment with payload:", payload); await saveAppointment(payload); // Save to backend + await updateCourseStatus(course?.courseId || id); console.log("Form submitted successfully:", payload); // Redirect to courses page after successful submission @@ -119,7 +120,7 @@ const CourseForm = () => {