File tree 1 file changed +5
-4
lines changed
feature/auth/src/main/java/com/mifos/feature/auth/login
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 10
10
package com.mifos.feature.auth.login
11
11
12
12
import android.content.Context
13
- import android.util.Log
14
13
import androidx.lifecycle.ViewModel
15
14
import androidx.lifecycle.viewModelScope
16
15
import com.mifos.core.common.utils.Network
@@ -88,9 +87,8 @@ class LoginViewModel @Inject constructor(
88
87
}
89
88
90
89
is Resource .Success -> {
91
- result.data?.let {
92
- Log .d(" Android" , " $it " )
93
- prefManager.saveUserDetails(it)
90
+ if (result.data?.authenticated == true ) {
91
+ prefManager.saveUserDetails(result.data!! )
94
92
// Saving username password
95
93
prefManager.usernamePassword = Pair (username, password)
96
94
// Updating Services
@@ -102,6 +100,9 @@ class LoginViewModel @Inject constructor(
102
100
secured = true ,
103
101
)
104
102
_loginUiState .value = LoginUiState .Success
103
+ } else {
104
+ _loginUiState .value =
105
+ ShowError (R .string.feature_auth_error_login_failed)
105
106
}
106
107
}
107
108
}
You can’t perform that action at this time.
0 commit comments