Last active
December 28, 2019 06:21
-
-
Save lagoJin/4b65c3785520d259f9071622b7b95538 to your computer and use it in GitHub Desktop.
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
class MainViewModel @Inject constructor( | |
private val githubUseCase: GIthubUseCase) : BaseViewModel() { | |
private val _result = MutableLiveData<List<DomainEntityGithub>>() | |
val result: LiveData<List<DomainEntityGithub>> | |
get() = _result | |
fun search(query: String, page:Int, count :Int) { | |
_dataLoading.postValue(true) | |
githubUseCase.invoke(viewModelScope, GithubUseCase.Params(query, page, count), | |
{ | |
_dataLoading.postValue(false) | |
_result.postValue(it) | |
}, | |
{ | |
_dataLoading.postValue(false) | |
_error.postValue(true) | |
} | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment