Skip to content

Instantly share code, notes, and snippets.

@lagoJin
Last active December 28, 2019 06:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lagoJin/4b65c3785520d259f9071622b7b95538 to your computer and use it in GitHub Desktop.
Save lagoJin/4b65c3785520d259f9071622b7b95538 to your computer and use it in GitHub Desktop.
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