Skip to content

20260220 fe #214 about attendace page#244

Merged
discipline24 merged 7 commits into
mainfrom
20260220-FE-#214-About-Attendace-Page
Feb 26, 2026
Merged

20260220 fe #214 about attendace page#244
discipline24 merged 7 commits into
mainfrom
20260220-FE-#214-About-Attendace-Page

Conversation

@yyunee
Copy link
Copy Markdown
Contributor

@yyunee yyunee commented Feb 26, 2026

1) #214

2) 변경 요약 (What & Why)

useCheckIn hook 추가

로그인 폼 수정


3) 스크린샷 / 동영상 (UI 변경 시)

(해당 PR은 UI 변경 없음)


4) 상세 변경사항

1. useCheckIn hook 추가 (qr 스캔 후 사용되는 훅)

  • useCheckIn hook 추가
  • token 존재 여부에 따른 출석 API 호출 처리
  • 출석 성공/실패에 대한 toast 메시지 처리
  • 예외 케이스(중복 출석, 만료된 QR 등)에 대한 에러 핸들링 통합
  • URL 내 token 제거 로직 추가 (중복 요청 방지)

2. 로그인 폼 수정( 로그인 안된 상태로 qr 스캔하는 경우 처리)

  • returnUrl 파라미터 처리 로직 추가
  • 로그인 성공 시 기존 페이지로 복귀하도록 개선
  • QR → 로그인 → 자동 출석 처리 흐름 완성
  • replace: true 사용하여 히스토리 스택 정리

5) 참고사항

  • 출석관리 UI는 추후 수정 예정
  • 조회 시 라운드/세션 데이터 로딩에 다소 시간이 소요됨

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • 로그인 후 이전 페이지로 자동 리다이렉트되는 기능이 추가되었습니다.
    • 출석 페이지에서 직접 체크인 기능을 사용할 수 있게 되었습니다.
  • 개선 사항

    • API 통신 방식이 최적화되었습니다.
    • 기존 체크인 페이지 경로가 비활성화되었습니다.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 26, 2026

Warning

Rate limit exceeded

@yyunee has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 9 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 5d5685b and ef11490.

📒 Files selected for processing (2)
  • frontend/src/components/login/LoginForm.jsx
  • frontend/src/hooks/useCheckIn.js

개요

이 PR은 CheckInPage 라우트를 비활성화하고, 로그인 후 리다이렉트를 위해 returnUrl 쿼리 파라미터 지원을 추가하며, QR 토큰 기반의 출석 체크인을 처리하는 새로운 useCheckIn 훅을 도입합니다. 또한 axios의 baseURL을 상대 URL 사용으로 변경합니다.

변경사항

Cohort / File(s) 요약
라우트 및 출석 페이지
frontend/src/App.jsx, frontend/src/pages/Attendance.jsx
CheckInPage 라우트 비활성화 및 Attendance 페이지에 useCheckIn 훅 통합
로그인 흐름
frontend/src/components/login/LoginForm.jsx
useSearchParams를 통해 returnUrl 쿼리 파라미터를 읽고, 로그인 성공 시 반환 URL로 조건부 리다이렉트
출석 체크인 훅
frontend/src/hooks/useCheckIn.js
QR 토큰을 URL 파라미터에서 읽고, /api/attendance/check-in API를 호출하여 체크인 처리하는 새로운 훅
API 기본 설정
frontend/src/utils/axios.js
axios baseURL을 환경 변수 기반에서 빈 문자열로 변경하여 상대 URL 사용

시퀀스 다이어그램

sequenceDiagram
    participant User as 사용자<br/>(QR 토큰 포함)
    participant Browser as 브라우저
    participant AttendancePage as Attendance<br/>페이지
    participant useCheckIn as useCheckIn<br/>훅
    participant API as 출석<br/>API
    participant Toast as Toast<br/>알림

    User->>Browser: QR 토큰 포함 URL 방문
    Browser->>AttendancePage: Attendance 페이지 로드
    AttendancePage->>useCheckIn: useCheckIn() 호출
    useCheckIn->>useCheckIn: URL에서 토큰 추출
    useCheckIn->>API: POST /api/attendance/check-in<br/>(qrToken 포함)
    alt 성공
        API-->>useCheckIn: 성공 응답
        useCheckIn->>Toast: 성공 알림 표시
        useCheckIn->>Browser: 현재 경로로 replace 네비게이션
    else 실패
        API-->>useCheckIn: 오류 응답
        useCheckIn->>Toast: 오류 알림 표시
        useCheckIn->>Browser: 페이지 유지
    end
Loading

코드 리뷰 난이도

🎯 3 (보통) | ⏱️ ~20분

관련 PR

제안 검토자

  • DongEun02
  • Kosw6
  • gxuoo

🐰 QR 토큰이 반짝반짝,
훅이 달려 API 호출!
귀여운 경로로 쏙 리다이렉트,
출석 체크인 완벽하게! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive 제목이 모호하고 구체성이 부족합니다. '20260220 fe #214 about attendace page'는 날짜와 이슈 번호를 포함하지만, 실제 변경 사항(QR 기반 체크인, 로그인 흐름 개선)을 명확하게 설명하지 않습니다. 제목을 'Add QR-based check-in flow with return URL support in login' 또는 'Implement useCheckIn hook and login redirect flow' 같이 변경하여 주요 변경 사항을 명확하게 전달하세요.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 20260220-FE-#214-About-Attendace-Page

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/src/App.jsx`:
- Line 69: The commented-out Route for "/attendance/check-in" removes backward
compatibility for QR links; restore a route that serves the same logic as the
new Attendance flow by adding a Route for path "/attendance/check-in" that
renders (or redirects to) the existing Attendance component which uses the
useCheckIn hook, or implement a client-side redirect from "/attendance/check-in"
to the new attendance path so existing QR codes continue to work; update App.jsx
to reintroduce that mapping while keeping the single Attendance component and
its useCheckIn usage intact.

In `@frontend/src/components/login/LoginForm.jsx`:
- Around line 16-18: The code reads returnUrl from useSearchParams in the
LoginForm and then navigates to it without validation, which allows
open-redirects; fix by validating/sanitizing returnUrl before any navigation:
ensure returnUrl is an internal relative path (e.g., starts with a single '/'
and does not start with '//' and contains no scheme like 'http:' or host part),
optionally compare against an allowlist of known internal routes, and if invalid
or absent fall back to a safe default (e.g., '/'), then use that safe path for
navigation; also remove the stray console.log at the login submission (the
console.log on Line 47) to avoid leaking data.

In `@frontend/src/hooks/useCheckIn.js`:
- Around line 14-16: Remove or guard debug console logging that exposes the QR
token and detailed failure info in the useCheckIn hook: locate the console.log
calls inside the useCheckIn function that print '=== useCheckIn 실행 ===', '현재
token:', and any subsequent logs that print token or error details (including
the other occurrences noted), and either delete them or wrap them with a
development-only guard (e.g., check process.env.NODE_ENV === 'development'
before logging) so tokens and sensitive failure information are not emitted in
production. Ensure only non-sensitive, generic messages remain in production.
- Around line 11-20: The current duplicate-execution guard uses hasChecked as a
boolean which prevents re-running when token changes; instead store the
last-processed token in the ref and compare tokens: change hasChecked from
useRef(false) to useRef(null) (or useRef<string | null>()), inside the useEffect
check if hasChecked.current === token then return, and after running set
hasChecked.current = token; update both occurrences that use hasChecked and the
useEffect in useCheckIn (and the similar guard at the other location) so the
effect re-runs when token changes but still prevents duplicate runs for the same
token.
- Around line 37-39: The toast currently reads err.response?.data?.message which
doesn't match our axios interceptor's rejected shape ({ status, message, data
}), so update the error handling in frontend/src/hooks/useCheckIn.js (where
toast.error is called) to prefer the interceptor's err.message, then fall back
to err.data?.message, then the existing default string; ensure you reference the
same error object used in the catch block and pass that combined message into
toast.error.

In `@frontend/src/utils/axios.js`:
- Around line 2-5: Replace the hardcoded baseURL in the axios instance with the
BASE_URL variable so production uses the configured API host: update the api
axios.create call (symbol: api and axios.create) to set baseURL to BASE_URL (or
BASE_URL || '') instead of the empty string, and ensure any token refresh call
that already uses BASE_URL uses the same variable so API requests and the token
refresh endpoint are consistent.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e650a20 and 5d5685b.

📒 Files selected for processing (5)
  • frontend/src/App.jsx
  • frontend/src/components/login/LoginForm.jsx
  • frontend/src/hooks/useCheckIn.js
  • frontend/src/pages/Attendance.jsx
  • frontend/src/utils/axios.js

Comment thread frontend/src/App.jsx
Comment thread frontend/src/components/login/LoginForm.jsx
Comment thread frontend/src/hooks/useCheckIn.js Outdated
Comment thread frontend/src/hooks/useCheckIn.js Outdated
Comment thread frontend/src/hooks/useCheckIn.js
Comment thread frontend/src/utils/axios.js
discipline24
discipline24 previously approved these changes Feb 26, 2026
Copy link
Copy Markdown
Contributor

@discipline24 discipline24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다~

@discipline24 discipline24 merged commit 0bda22f into main Feb 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants