Skip to content

Commit

Permalink
[mod] #236 홈에서 동기로 처리했던 로직 비동기로 되돌리기
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan2dani committed Sep 2, 2024
1 parent fe2e9c4 commit 3b059fb
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ class HomeViewModel @Inject constructor(
fetchBestList()
}

// 하나의 스코프를 만들어서 각 함수들이 동기적으로 처리되도록 수정
fun fetchBestList() {
private fun fetchBestList() {
viewModelScope.launch {
homeRepository.fetchBestBakery()
.onSuccess { bestBakeryList ->
Expand All @@ -53,7 +52,9 @@ class HomeViewModel @Inject constructor(
.onFailure { throwable ->
_bestBakeryListState.value = UiState.Error(throwable.message)
}
}

viewModelScope.launch {
homeRepository.fetchBestReview()
.onSuccess { bestReviewList ->
_bestReviewListState.value = UiState.Success(bestReviewList)
Expand Down

0 comments on commit 3b059fb

Please sign in to comment.