-
Notifications
You must be signed in to change notification settings - Fork 4
[UI, FEAT] 로그아웃 기능 구현 #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Walkthrough로그아웃 기능이 추가되었다. 요청/응답 DTO가 신설되고, RemoteAuthDataSource와 AuthRepository에 logout API가 도입되었다. MyPageViewModel에 TokenManager 연계 로그아웃 로직이 추가되었고, MyPageScreen에 로그아웃/회원탈퇴 버튼과 확인 다이얼로그 UI가 포함되었다. MyClubComponent는 Column 기반 렌더링으로 변경되었다. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant S as MyPageScreen
participant VM as MyPageViewModel
participant AR as AuthRepository
participant DS as RemoteAuthDataSource
participant API as HTTP API
participant TM as TokenManager
U->>S: 탭: 로그아웃
S->>VM: logout()
VM->>TM: getRefreshToken()
alt refreshToken 없음
VM->>TM: clearTokens() + markExpired()
VM-->>S: 상태 업데이트(로그아웃 완료)
else refreshToken 존재
VM->>AR: logout(refreshToken)
AR->>DS: logout(refreshToken)
DS->>API: POST /auth/logout {refreshToken}
API-->>DS: 200 OK / 에러 응답
alt 성공
DS-->>AR: ApiResult.Success(LogoutResponseDto)
AR-->>VM: 성공 결과
VM->>TM: clearTokens() + markExpired()
VM-->>S: 상태 업데이트(로그아웃 완료)
else 에러
DS-->>AR: ApiResult.Error(...)
AR-->>VM: 에러 결과
VM-->>S: errorMessage 갱신
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
composeApp/src/commonMain/kotlin/org/whosin/client/presentation/mypage/component/MyClubComponent.kt (1)
68-94: 레이아웃 변경 확인됨
LazyColumn에서Column으로 변경되어 지연 로딩이 제거되었습니다. 현재 동아리 목록이 적다면 문제없지만, 향후 목록이 길어질 경우 성능 저하가 발생할 수 있습니다. 필요시 다시LazyColumn으로 전환하는 것을 고려해보세요.composeApp/src/commonMain/kotlin/org/whosin/client/data/remote/RemoteAuthDataSource.kt (1)
203-203: TODO 확인회원 탈퇴 API는 PR 설명에 명시된 대로 서버 구현 후 연결 예정이군요. 필요시 별도 이슈로 트래킹하시면 좋을 것 같습니다.
composeApp/src/commonMain/kotlin/org/whosin/client/presentation/mypage/MyPageViewModel.kt (2)
117-142: 로그아웃 로직 구현 확인로그아웃 로직이 잘 구현되었습니다:
- 리프레시 토큰이 없을 경우 바로 토큰 삭제 및 만료 처리
- 토큰이 있을 경우 서버에 로그아웃 요청 후 성공 시 토큰 삭제
- 에러 발생 시 적절한 에러 메시지 업데이트
다만 로그아웃 실패 시에도 토큰을 삭제하는 것이 사용자 경험 측면에서 나을 수 있습니다. 현재는 에러 메시지만 표시하고 토큰을 유지하는데, 사용자가 로그아웃 의도를 명확히 했다면 서버 응답과 무관하게 로컬 토큰을 삭제하는 것도 고려해볼 만합니다.
필요시 에러 케이스에서도 토큰을 삭제하도록 수정할 수 있습니다:
is ApiResult.Error -> { + // 로그아웃 실패 시에도 로컬 토큰 삭제 + tokenManager.clearToken() + TokenExpiredManager.setTokenExpired() _uiState.value = _uiState.value.copy( errorMessage = result.message ?: "로그아웃에 실패했습니다." ) println("MyPageViewModel: 로그아웃 실패 - ${result.message}") }
144-144: TODO 확인회원 탈퇴 기능은 PR 설명에 따르면 서버 구현 후 연결 예정이군요.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
composeApp/src/commonMain/kotlin/org/whosin/client/data/dto/request/LogoutRequestDto.kt(1 hunks)composeApp/src/commonMain/kotlin/org/whosin/client/data/dto/response/LogoutResponseDto.kt(1 hunks)composeApp/src/commonMain/kotlin/org/whosin/client/data/remote/RemoteAuthDataSource.kt(2 hunks)composeApp/src/commonMain/kotlin/org/whosin/client/data/repository/AuthRepository.kt(2 hunks)composeApp/src/commonMain/kotlin/org/whosin/client/presentation/mypage/MyPageScreen.kt(6 hunks)composeApp/src/commonMain/kotlin/org/whosin/client/presentation/mypage/MyPageViewModel.kt(5 hunks)composeApp/src/commonMain/kotlin/org/whosin/client/presentation/mypage/component/MyClubComponent.kt(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
composeApp/src/commonMain/kotlin/org/whosin/client/data/repository/AuthRepository.kt (2)
composeApp/src/commonMain/kotlin/org/whosin/client/data/repository/ClubRepository.kt (2)
checkOut(22-23)dataSource(10-30)composeApp/src/commonMain/kotlin/org/whosin/client/di/DIModules.kt (1)
AuthRepository(47-47)
composeApp/src/commonMain/kotlin/org/whosin/client/data/dto/response/LogoutResponseDto.kt (4)
composeApp/src/commonMain/kotlin/org/whosin/client/data/dto/response/LoginResponseDto.kt (2)
success(6-18)accessToken(20-26)composeApp/src/commonMain/kotlin/org/whosin/client/data/dto/response/AddClubResponseDto.kt (1)
success(6-16)composeApp/src/commonMain/kotlin/org/whosin/client/data/dto/response/SignupResponseDto.kt (1)
success(6-18)composeApp/src/commonMain/kotlin/org/whosin/client/data/dto/response/FindPasswordResponseDto.kt (1)
success(6-18)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: ios-build
- GitHub Check: android-build
🔇 Additional comments (9)
composeApp/src/commonMain/kotlin/org/whosin/client/data/dto/request/LogoutRequestDto.kt (1)
1-10: LGTM!로그아웃 요청 DTO가 올바르게 구현되었습니다. 직렬화 어노테이션이 적절히 적용되어 있습니다.
composeApp/src/commonMain/kotlin/org/whosin/client/data/repository/AuthRepository.kt (1)
41-42: LGTM!로그아웃 메서드가 올바르게 추가되었습니다. 기존 패턴과 일관성 있게 데이터 소스에 위임하고 있습니다.
composeApp/src/commonMain/kotlin/org/whosin/client/data/remote/RemoteAuthDataSource.kt (1)
167-201: LGTM!로그아웃 API 구현이 올바르게 작성되었습니다. 에러 핸들링이 기존
login메서드와 일관된 패턴을 따르고 있으며, 성공/실패 케이스를 적절히 처리하고 있습니다.composeApp/src/commonMain/kotlin/org/whosin/client/presentation/mypage/MyPageScreen.kt (4)
58-58: LGTM!다이얼로그 상태 관리가 올바르게 구현되었습니다.
77-199: LGTM!스크롤 가능한 레이아웃으로 잘 구성되었습니다.
weight(1f)와verticalScroll을 활용해 하단 버튼 영역을 고정하면서 나머지 콘텐츠를 스크롤할 수 있도록 구현한 점이 좋습니다.
141-179: LGTM!로그아웃 및 회원 탈퇴 버튼이 적절한 색상과 레이아웃으로 구현되었습니다. 로그아웃은 ViewModel의
logout()메서드를 호출하고, 회원 탈퇴는 확인 다이얼로그를 표시하도록 되어 있네요.
202-252: 회원 탈퇴 다이얼로그 구현 확인다이얼로그가 잘 구현되었습니다. 회원 탈퇴 API는 TODO로 표시되어 있으며, PR 설명에 따르면 서버 구현 후 연결 예정이군요.
composeApp/src/commonMain/kotlin/org/whosin/client/data/dto/response/LogoutResponseDto.kt (1)
1-16: LGTM!로그아웃 응답 DTO가 올바르게 구현되었습니다. 기존 응답 DTO들(
LoginResponseDto,SignupResponseDto등)과 일관된 구조를 따르고 있습니다.composeApp/src/commonMain/kotlin/org/whosin/client/presentation/mypage/MyPageViewModel.kt (1)
26-28: LGTM!생성자가
MemberRepository,AuthRepository,TokenManager를 주입받도록 올바르게 업데이트되었습니다.
🚀 이슈번호
✏️ 변경사항
📷 스크린샷
Screen_Recording_20251010_145522_WhosInClient.mp4
✍️ 사용법
🎸 기타
Summary by CodeRabbit