refactor: move api request logic completely out of core
This commit is contained in:
parent
f606eb2e33
commit
0a5b0f532a
5 changed files with 74 additions and 57 deletions
|
|
@ -122,13 +122,13 @@ class LoginViewModel(
|
|||
}
|
||||
|
||||
suspend fun login(email: String, password: String): LoginResult {
|
||||
return try {
|
||||
when (val res = auth.login(email, password)) {
|
||||
is AuthResponse.Success -> LoginResult.Success
|
||||
return when (val res = auth.login(email, password)) {
|
||||
is AuthResponse.Success -> LoginResult.Success
|
||||
is AuthResponse.Failed -> {
|
||||
val e = res.error
|
||||
logger.e(e) { "Login failed" }
|
||||
LoginResult.Failed(e.toString())
|
||||
}
|
||||
} catch(e: Throwable) {
|
||||
logger.e(e) { "Login failed" }
|
||||
LoginResult.Failed(e.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue