Skip to content

fix: [TA-206] res.data.user 또는 res.data.user.roles 접근 시 런타임 TypeError 가능#92

Merged
seorinn merged 2 commits into
developfrom
TA-206-fix-auth-login-user-access
May 11, 2026
Merged

fix: [TA-206] res.data.user 또는 res.data.user.roles 접근 시 런타임 TypeError 가능#92
seorinn merged 2 commits into
developfrom
TA-206-fix-auth-login-user-access

Conversation

@seorinn

@seorinn seorinn commented May 11, 2026

Copy link
Copy Markdown
Collaborator

요약

  • authLogin 함수에서 res.data.user.id / res.data.user.roles 직접 접근 시 서버 응답에 user 객체가 없거나 roles 필드가 누락된 경우 발생하는 런타임 TypeError 방지
  • 옵셔널 체이닝(?.) 및 nullish 기본값(?? [], ?? -1) 적용

변경 사항

  • src/auth/login.tsx: setUser 호출 시 res.data.user?.id ?? -1, res.data.user?.roles ?? [] 로 안전하게 접근

테스트 방법

  • 카카오 로그인 후 정상적으로 메인 화면으로 이동하는지 확인
  • 서버가 user 필드를 포함하지 않는 응답을 반환해도 TypeError 없이 처리되는지 확인

Closes TA-206

@vercel

vercel Bot commented May 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
damaba Ready Ready Preview, Comment May 11, 2026 6:36am

@seorinn seorinn marked this pull request as ready for review May 11, 2026 06:37
@seorinn seorinn merged commit cbb33d0 into develop May 11, 2026
3 checks passed
@seorinn seorinn deleted the TA-206-fix-auth-login-user-access branch May 11, 2026 06:37
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.

1 participant