Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion frontend/src/components/TaskModal.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useState } from "react";
import styles from "../pages/admin/ManageTask.module.css";
import api from "../api/api";

const TaskModal = ({ weekInfo, onClose }) => {
const [topic, setTopic] = useState("");
Expand All @@ -16,6 +17,27 @@ const TaskModal = ({ weekInfo, onClose }) => {
setTaskList([...taskList, ""]);
};

const handleSave = async () => {
const requests = taskList.map((task, index) =>
api.post("/admin/assignment/signup", {
subject: topic,
assignmentName: task,
week: parseInt(weekInfo.week),
day: day,
orderNumber: index + 1,
})
);

try {
await Promise.all(requests);
alert("과제가 저장되었습니다.");
onClose();
} catch (error) {
console.error("저장 오류:", error);
alert("과제 저장 중 오류가 발생했습니다.");
}
};

return (
<div className={styles.modal_overlay}>
<div className={styles.modal}>
Expand Down Expand Up @@ -52,7 +74,9 @@ const TaskModal = ({ weekInfo, onClose }) => {
</button>
</div>
<div className={styles.modal_footer}>
<button className={styles.save_button}>save</button>
<button className={styles.save_button} onClick={handleSave}>
save
</button>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/pages/admin/DetailManageStudent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const DetailManageStudent = () => {
const fetchStudent = async () => {
try {
const data = await getStudentDetail(numericId);
console.log("API 응답 데이터:", data); // 확인 포인트
setStudent(data);
} catch (err) {
console.error("학생 상세 정보 불러오기 실패:", err);
Expand Down