Last active
May 19, 2019 12:36
-
-
Save varshabhatia007/67262a575ccb645cd8a1ecf7219d35e9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
private fun getCustomerDataFromApi() { | |
customerUsecase.getCustomerData() | |
.observeOn(AndroidSchedulers.mainThread()) | |
.doOnSubscribe { view.showLoader() } | |
.doOnEvent { _, _ -> view.hideLoader() } | |
.subscribe( | |
{ | |
view.populateData(it) | |
}, | |
{ e -> | |
Log.e(TAG(), e.message, e) | |
if (e is NetworkError) { | |
view.showError(e.toModel()) | |
} else { | |
view.showCustomError() | |
} | |
} | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment