From 62488c3a5c793a6f634f8da6ba30e8eb753ae19b Mon Sep 17 00:00:00 2001 From: SsongSik Date: Wed, 10 May 2023 09:36:38 +0900 Subject: [PATCH] =?UTF-8?q?[refactor]=20:=20#83=20StateFlow=20=EB=A7=88?= =?UTF-8?q?=EC=9D=B4=EA=B7=B8=EB=A0=88=EC=9D=B4=EC=85=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/viewmodel/search/LoveViewModel.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/myongsik/myongsikandroid/presentation/viewmodel/search/LoveViewModel.kt b/app/src/main/java/com/myongsik/myongsikandroid/presentation/viewmodel/search/LoveViewModel.kt index b3cdeaa5..4175a640 100644 --- a/app/src/main/java/com/myongsik/myongsikandroid/presentation/viewmodel/search/LoveViewModel.kt +++ b/app/src/main/java/com/myongsik/myongsikandroid/presentation/viewmodel/search/LoveViewModel.kt @@ -71,13 +71,12 @@ class LoveViewModel @Inject constructor( } } - private val _scrapRestaurant = MutableLiveData() - val scrapRestaurant: LiveData - get() = _scrapRestaurant + private val _scrapRestaurant = MutableStateFlow(null) + val scrapRestaurant: StateFlow = _scrapRestaurant.asStateFlow() fun scarpRestaurant(requestScrap: RequestScrap) = launch { postScrapRestaurantDataUseCase(requestScrap.toRequestScrapEntity())?.let{ - _scrapRestaurant.postValue(it.toResponseScrapData()) + _scrapRestaurant.value = it.toResponseScrapData() } } } \ No newline at end of file