Skip to content

Commit

Permalink
[refactor] : #83 StateFlow 마이그레이션
Browse files Browse the repository at this point in the history
  • Loading branch information
SsongSik committed May 10, 2023
1 parent 7908bc5 commit 62488c3
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,12 @@ class LoveViewModel @Inject constructor(
}
}

private val _scrapRestaurant = MutableLiveData<ResponseScrap>()
val scrapRestaurant: LiveData<ResponseScrap>
get() = _scrapRestaurant
private val _scrapRestaurant = MutableStateFlow<ResponseScrap?>(null)
val scrapRestaurant: StateFlow<ResponseScrap?> = _scrapRestaurant.asStateFlow()

fun scarpRestaurant(requestScrap: RequestScrap) = launch {
postScrapRestaurantDataUseCase(requestScrap.toRequestScrapEntity())?.let{
_scrapRestaurant.postValue(it.toResponseScrapData())
_scrapRestaurant.value = it.toResponseScrapData()
}
}
}

0 comments on commit 62488c3

Please sign in to comment.