diff --git a/frontend/src/api/api.js b/frontend/src/api/api.js index c2c9d61..7be2e6e 100644 --- a/frontend/src/api/api.js +++ b/frontend/src/api/api.js @@ -1,7 +1,9 @@ import axios from "axios"; const api = axios.create({ + baseURL: "https://api.pirocheck.org/api", + // 수정 필요한지 재검 필요함 // "http://api.pirocheck.org:8080/api" withCredentials: true, diff --git a/frontend/src/pages/admin/AdminStudentAssignment.jsx b/frontend/src/pages/admin/AdminStudentAssignment.jsx index b02cf21..7b76b46 100644 --- a/frontend/src/pages/admin/AdminStudentAssignment.jsx +++ b/frontend/src/pages/admin/AdminStudentAssignment.jsx @@ -64,12 +64,20 @@ const AdminStudentAssignment = () => { }); }, [studentId, week]); - const handleStatusChange = (weekIdx, dayIdx, taskIdx, newStatus) => { - const updated = [...weeks]; - const task = updated[weekIdx].days[dayIdx].tasks[taskIdx]; - task.status = newStatus; - task.modified = true; - setWeeks(updated); + const handleStatusChange = (taskId, newStatus) => { + const updatedWeeks = weeks.map((weekItem) => ({ + ...weekItem, + days: weekItem.days.map((dayItem) => ({ + ...dayItem, + tasks: dayItem.tasks.map((task) => + task.id === taskId + ? { ...task, status: newStatus, modified: true } + : task + ), + })), + })); + + setWeeks(updatedWeeks); }; /* const handleSave = async (taskId, status) => { @@ -134,8 +142,6 @@ const AdminStudentAssignment = () => { value={task.status} onChange={(e) => handleStatusChange( - weekIdx, - dayIdx, taskIdx, e.target.value )