forked from CSI-KJSCE/appointment_to_examiner
Fixed backend issue, update course status working
This commit is contained in:
@@ -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 = () => {
|
||||
<form onSubmit={handleSubmit}>
|
||||
<label>
|
||||
Course ID:
|
||||
<input type="text" value={course?.id || id} readOnly />
|
||||
<input type="text" value={course?.courseId || id} readOnly />
|
||||
</label>
|
||||
<label>
|
||||
Course Name:
|
||||
|
||||
Reference in New Issue
Block a user