diff --git a/app/src/main/java/com/mindorks/framework/mvi/ui/main/viewmodel/MainViewModel.kt b/app/src/main/java/com/mindorks/framework/mvi/ui/main/viewmodel/MainViewModel.kt index a143ab3..280d065 100644 --- a/app/src/main/java/com/mindorks/framework/mvi/ui/main/viewmodel/MainViewModel.kt +++ b/app/src/main/java/com/mindorks/framework/mvi/ui/main/viewmodel/MainViewModel.kt @@ -37,14 +37,12 @@ class MainViewModel( } } - private fun fetchUser() { - viewModelScope.launch { - _state.value = MainState.Loading - _state.value = try { - MainState.Users(repository.getUsers()) - } catch (e: Exception) { - MainState.Error(e.localizedMessage) - } + private suspend fun fetchUser() { + _state.value = MainState.Loading + _state.value = try { + MainState.Users(repository.getUsers()) + } catch (e: Exception) { + MainState.Error(e.localizedMessage) } } } \ No newline at end of file