Skip to content
Open
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
2 changes: 2 additions & 0 deletions frontend/src/api/api.js
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
22 changes: 14 additions & 8 deletions frontend/src/pages/admin/AdminStudentAssignment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -134,8 +142,6 @@ const AdminStudentAssignment = () => {
value={task.status}
onChange={(e) =>
handleStatusChange(
weekIdx,
dayIdx,
taskIdx,
e.target.value
)
Expand Down