Created
July 1, 2019 12:36
-
-
Save Papashkin/e1304bdb65ebbb78cd956d3453b0597b to your computer and use it in GitHub Desktop.
LogInRequest usecase
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 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