diff --git a/android/src/main/java/com/wbrawner/budget/AsyncState.kt b/android/src/main/java/com/wbrawner/budget/AsyncState.kt index 1a810e8..ada586e 100644 --- a/android/src/main/java/com/wbrawner/budget/AsyncState.kt +++ b/android/src/main/java/com/wbrawner/budget/AsyncState.kt @@ -21,6 +21,8 @@ interface AsyncViewModel { val state: MutableLiveData> } +fun MutableLiveData>.postValue(value: T) = postValue(AsyncState.Success(value)) + fun VM.launch(block: suspend () -> T): Job where VM : ViewModel, VM : AsyncViewModel = viewModelScope.launch { state.postValue(AsyncState.Loading) try {