Skip to content
Merged
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
17 changes: 16 additions & 1 deletion frontend/src/pages/generation/Attendance.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ const Attendance = () => {
withCredentials: true, // 세션 기반 인증 요청처리
});

const slots = res.data.data?.[0]?.slots || [];
// api 응답 수정에 따라 업데이트
// 서버 응답이 순서대로 오지 않을 수 있으므로 order 기준으로 정렬
const slots = (res.data.data || []).sort((a, b) => a.order - b.order);

const statuses = slots.map((slot) => {
if (slot.status === true) return "success";
Expand All @@ -134,6 +136,19 @@ const Attendance = () => {
useEffect(() => {
fetchAttendance();
fetchTodayAttendance();

// 10초마다 출석체크 활성화 여부 확인 및 UI 업데이트
const interval = setInterval(() => {
// 출석 미진행 상태가 하나라도 있을 때만 호출
setTodayStatuses((prev) => {
if (prev.includes("not_started")) {
fetchTodayAttendance();
}
return prev;
});
}, 10000);

return () => clearInterval(interval);
}, []);

const handleChange = (index, value) => {
Expand Down