-
-
Save skydoves/e37561505e855418a126d8684aab59db to your computer and use it in GitHub Desktop.
handle_api_viewmodel_layer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
viewModelScope.launch { | |
when (val response = posterRemoteDataSource.invoke()) { | |
is NetworkResult.Success -> posterFlow.emit(response.data) | |
is NetworkResult.Error -> errorFlow.emit("${response.code} ${response.message}") | |
is NetworkResult.Exception -> errorFlow.emit("${response.e.message}") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment