-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat/#17: week7 xml 과제 구현 #18
base: develop-xml
Are you sure you want to change the base?
Conversation
feat/#13: week6 xml 과제 구현
…youjin-park into feat/week4_xml
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.
코드 진짜 깔끔하게 짜시네요.. 거의 코드 청소부🧹
너무 잘보고 갑니다~ 👍
suspend fun postSignUp(requestSignUp: RequestSignUpDto): UiState<ResponseAuthDto> { | ||
return withContext(Dispatchers.IO) { | ||
runCatching { | ||
ServicePool.authService.postSignUp(requestSignUp) | ||
}.fold( | ||
{ UiState.Success(it) }, | ||
{ UiState.Failure(it.message.toString()) } | ||
) | ||
} |
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.
이렇게 State를 정해서 뷰모델에 전달하는 방법도 있었네요!!
저장소와 상태관리 개념을 분리해야 할 것 같아서 저는 저장소에서 뷰모델에게 dto를 반환하도록 했는데 뭐가 올바른지 모르겠네요,,
지나가는 OB 있으면 답 좀 주시길,,
authService.postLogin(request) | ||
}.fold( | ||
{ response -> | ||
val userId = response.headers()["location"] |
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.
이런 부분도 하드코딩 대신 상수화해서 사용하면 좋을 것 같아여!
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.
7차 과제까지 잘 수행하셨군요..저는 막혀서 아직 PR을 못올렸답니다.. 우리조 코드보고 열심히 참고해서 올릴게요! 이번주차도 수고 많으셨어요~! :)
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.
UiState까지 사용하시는군요...역시... !!..! 저도 얼른 적용하겠습니다...
class UserProfileRepository { | ||
suspend fun getUserProfile(): UiState<ResponseUserInfoDto> { | ||
return withContext(Dispatchers.IO) { | ||
runCatching { | ||
ServicePool.userService.getUserInfo() | ||
}.fold( | ||
{ UiState.Success(it) }, | ||
{ UiState.Failure(it.message.toString()) } | ||
) | ||
} | ||
} |
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.
컴포즈 pr 에서도 말했지만 fold 새롭네요!
onSuccess와 onFailure를 명시할 필요가 없어 코드가 간결해졌군요
Related issue 🛠
Work Description ✏️
Screenshot 📸
KakaoTalk_20240508_163749744.mp4
To Reviewers 📢
week_4 브랜치가 안합쳐져서 뭐가 많네요..?
커밋 메시지 #17부터 보시면 됩니다!
⭐ 변경 사항 : Repository추가, ViewModel 수정 ⭐