Skip to content

Feat/homepage api - #19

Merged
YangJJune merged 2 commits into
mainfrom
feat/homepage-api
Mar 18, 2026
Merged

YangJJune merged 2 commits into
mainfrom
feat/homepage-api

Conversation

@YangJJune

Copy link
Copy Markdown
Contributor

📝 PR Description

홈 페이지의 UI를 실제 서버 데이터와 연동하고, 즐겨찾는 선수 목록을 가져오는 기능을 추가했습니다. 또한 API 요청 시 인증 토큰을 동적으로 처리하도록 개선했습니다.

🔧 Changes

  1. 즐겨찾기(Favorites) 기능 추가
  • useGetFavoritePlayers 커스텀 훅 및 관련 타입 정의

  • v1/favorites 엔드포인트를 통한 즐겨찾는 선수 ID 목록 조회 연동

  1. API 요청 로직 고도화 및 최적화
  • 인증(Auth): api/instance.ts에서 하드코딩된 "test" 토큰 대신 localStorage의 accessToken을 사용하도록 수정
  • 쿼리 간소화: useGetMatchSummary, useGetPlayerStats에서 중복되던 searchParams 제거 (경로 파라미터로 통합)
  • 활성화 조건: enabled: !!playerId 설정을 통해 불필요한 API 호출 방지
  1. 홈 페이지(HomePage) 리팩토링
  • 기존 Mock 데이터(testPlayerList)를 제거하고 useGetFavoritePlayers에서 받아온 실데이터 연동
  • useMemo를 사용한 playerIds 최적화
  • MatchCard 내 경기 하이라이트(text) 및 타격 기록(batting_record) 데이터 바인딩

@0798JiHyuk 0798JiHyuk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

코드 확인했습니다! approve 합니다.

@YangJJune
YangJJune merged commit 0b97936 into main Mar 18, 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