Skip to content
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

Open
wants to merge 73 commits into
base: develop-xml
Choose a base branch
from

Conversation

youjin09222
Copy link
Collaborator

@youjin09222 youjin09222 commented Jun 7, 2024

Related issue 🛠

Work Description ✏️

  • Repository를 활용하여 UI와 Data로직 분리

Screenshot 📸

KakaoTalk_20240508_163749744.mp4

To Reviewers 📢

week_4 브랜치가 안합쳐져서 뭐가 많네요..?
커밋 메시지 #17부터 보시면 됩니다!

⭐ 변경 사항 : Repository추가, ViewModel 수정 ⭐

youjin09222 and others added 24 commits May 25, 2024 05:51
@youjin09222 youjin09222 requested review from kez-lab and a team June 7, 2024 08:57
@youjin09222 youjin09222 self-assigned this Jun 7, 2024
Copy link
Member

@boiledEgg-s boiledEgg-s left a comment

Choose a reason for hiding this comment

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

코드 진짜 깔끔하게 짜시네요.. 거의 코드 청소부🧹
너무 잘보고 갑니다~ 👍

Comment on lines +11 to +19
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()) }
)
}
Copy link
Member

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"]
Copy link
Member

Choose a reason for hiding this comment

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

이런 부분도 하드코딩 대신 상수화해서 사용하면 좋을 것 같아여!

Copy link

@hyeeum hyeeum left a comment

Choose a reason for hiding this comment

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

7차 과제까지 잘 수행하셨군요..저는 막혀서 아직 PR을 못올렸답니다.. 우리조 코드보고 열심히 참고해서 올릴게요! 이번주차도 수고 많으셨어요~! :)

Copy link

Choose a reason for hiding this comment

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

UiState까지 사용하시는군요...역시... !!..! 저도 얼른 적용하겠습니다...

Comment on lines +10 to +20
class UserProfileRepository {
suspend fun getUserProfile(): UiState<ResponseUserInfoDto> {
return withContext(Dispatchers.IO) {
runCatching {
ServicePool.userService.getUserInfo()
}.fold(
{ UiState.Success(it) },
{ UiState.Failure(it.message.toString()) }
)
}
}
Copy link

Choose a reason for hiding this comment

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

컴포즈 pr 에서도 말했지만 fold 새롭네요!
onSuccess와 onFailure를 명시할 필요가 없어 코드가 간결해졌군요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants