Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Papashkin/e1304bdb65ebbb78cd956d3453b0597b to your computer and use it in GitHub Desktop.
Save Papashkin/e1304bdb65ebbb78cd956d3453b0597b to your computer and use it in GitHub Desktop.
LogInRequest usecase
class LogInRequest(
private val service: ApolloService
) : UseCase<LoginData, LoginResponse>() {
override fun buildObservable(criteria: LoginData): Observable<LoginResponse> =
service.logIn(criteria)
.doOnError {
if (it is HttpException) {
Throwable(getMessageByCode(it.code()))
} else {
Throwable(it.message)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment