BIT-726: Stub loading and errors for logging in (#93)

This commit is contained in:
Ramsey Smith
2023-10-03 16:29:49 -06:00
committed by Álison Fernandes
parent 38155dbefd
commit f57780bfe0
2 changed files with 21 additions and 3 deletions

View File

@@ -89,6 +89,11 @@ class LoginViewModel @Inject constructor(
private fun attemptLogin(captchaToken: String?) {
viewModelScope.launch {
// TODO: show progress here BIT-320
sendEvent(
event = LoginEvent.ShowToast(
message = "Loading...",
),
)
val result = authRepository.login(
email = mutableStateFlow.value.emailAddress,
password = mutableStateFlow.value.passwordInput,
@@ -96,7 +101,13 @@ class LoginViewModel @Inject constructor(
)
when (result) {
// TODO: show an error here BIT-320
LoginResult.Error -> Unit
LoginResult.Error -> {
sendEvent(
event = LoginEvent.ShowToast(
message = "Error when logging in",
),
)
}
// No action required on success, root nav will navigate to logged in state
LoginResult.Success -> Unit
is LoginResult.CaptchaRequired -> {