Skip to content

Commit aadcc89

Browse files
committed
[fix]: ManagaTask.jsx save_btn 핸들링 처리 추가
1 parent eb28023 commit aadcc89

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

frontend/src/components/TaskModal.jsx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useState } from "react";
22
import styles from "../pages/admin/ManageTask.module.css";
3+
import api from "../api/api";
34

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

20+
const handleSave = async () => {
21+
const requests = taskList.map((task, index) =>
22+
api.post("/admin/assignment/signup", {
23+
subject: topic,
24+
assignmentName: task,
25+
week: parseInt(weekInfo.week),
26+
day: day,
27+
orderNumber: index + 1,
28+
})
29+
);
30+
31+
try {
32+
await Promise.all(requests);
33+
alert("과제가 저장되었습니다.");
34+
onClose();
35+
} catch (error) {
36+
console.error("저장 오류:", error);
37+
alert("과제 저장 중 오류가 발생했습니다.");
38+
}
39+
};
40+
1941
return (
2042
<div className={styles.modal_overlay}>
2143
<div className={styles.modal}>
@@ -52,7 +74,9 @@ const TaskModal = ({ weekInfo, onClose }) => {
5274
</button>
5375
</div>
5476
<div className={styles.modal_footer}>
55-
<button className={styles.save_button}>save</button>
77+
<button className={styles.save_button} onClick={handleSave}>
78+
save
79+
</button>
5680
</div>
5781
</div>
5882
</div>

frontend/src/pages/admin/DetailManageStudent.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const DetailManageStudent = () => {
2323
const fetchStudent = async () => {
2424
try {
2525
const data = await getStudentDetail(numericId);
26+
console.log("API 응답 데이터:", data); // 확인 포인트
2627
setStudent(data);
2728
} catch (err) {
2829
console.error("학생 상세 정보 불러오기 실패:", err);

0 commit comments

Comments
 (0)