Skip to content

Commit

Permalink
chore/#12: event 발생 위치 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
kangyein9892 committed Jan 4, 2025
1 parent 7d6bff0 commit 8c07f52
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ package org.sopt.and.presentation.my.contract
import org.sopt.and.presentation.util.base.UiEvent

sealed class MyEvent: UiEvent {
data class GetMyHobby(val token: String): MyEvent()
data class GetMyHobby(val hobby: String): MyEvent()
data object OnLogoutButtonClick: MyEvent()
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class MyViewModel @Inject constructor(
navigateToSignIn()
}
is MyEvent.GetMyHobby -> {
getMyHobby()
setState { copy(hobby = event.hobby) }
}
}
}
Expand All @@ -38,7 +38,7 @@ class MyViewModel @Inject constructor(
fun getMyHobby() = viewModelScope.launch {
val token = userRepository.getToken()
userRepository.getMyHobby(token).onSuccess { result ->
setState { copy(hobby = result.hobby) }
setEvent(MyEvent.GetMyHobby(result.hobby))
networkDelegate.handleNetworkSuccess()
}.onError {
networkDelegate.handleGetMyHobbyError(it)
Expand Down

0 comments on commit 8c07f52

Please sign in to comment.