From dcb61a82a1cca9e71234166de27ee69def45127d Mon Sep 17 00:00:00 2001 From: Imggaggu Date: Sat, 24 May 2025 15:58:36 +0900 Subject: [PATCH] =?UTF-8?q?[Fix]=20url=20routing:=20studentid=20=EC=88=AB?= =?UTF-8?q?=EC=9E=90=20=EC=95=84=EB=8B=90=20=EC=8B=9C=20=EC=88=AB=EC=9E=90?= =?UTF-8?q?=EB=A1=9C=20=EB=B0=94=EA=BF=94=EC=98=A4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/admin/AdminStudentAssignment.jsx | 12 +++++++----- frontend/src/pages/admin/AdminStudentAttendance.jsx | 5 +++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/frontend/src/pages/admin/AdminStudentAssignment.jsx b/frontend/src/pages/admin/AdminStudentAssignment.jsx index 3ff03d3..ee2bffd 100644 --- a/frontend/src/pages/admin/AdminStudentAssignment.jsx +++ b/frontend/src/pages/admin/AdminStudentAssignment.jsx @@ -14,17 +14,19 @@ import { const AdminStudentAssignment = () => { const { studentId, week } = useParams(); - if (!studentId || !week) { - console.warn("studentId 또는 week 없음", { studentId, week }); - return
잘못된 접근입니다.
; // 또는 로딩 UI - } const [studentInfo, setStudentInfo] = useState(null); const [weeks, setWeeks] = useState([]); const [highlightCard, setHighlightCard] = useState(null); const [selectedWeekLabel, setSelectedWeekLabel] = useState(null); useEffect(() => { - fetchStudentInfo(studentId).then((res) => { + const id = Number(studentId); + if (!id || isNaN(id)) { + console.warn("❗ 잘못된 studentId:", studentId); + return; + } + + fetchStudentInfo(id).then((res) => { setStudentInfo(res.data.data); }); diff --git a/frontend/src/pages/admin/AdminStudentAttendance.jsx b/frontend/src/pages/admin/AdminStudentAttendance.jsx index 9bdc211..5e75e02 100644 --- a/frontend/src/pages/admin/AdminStudentAttendance.jsx +++ b/frontend/src/pages/admin/AdminStudentAttendance.jsx @@ -14,6 +14,11 @@ const AdminStudentAttendance = () => { const [selectedDate, setSelectedDate] = useState(null); useEffect(() => { + const id = Number(studentId); + if (!id || isNaN(id)) { + console.warn("❗ 잘못된 studentId:", studentId); + return; + } const fetchData = async () => { try { const studentRes = await getStudentBasicInfo(studentId);