@@ -42,8 +42,7 @@ class LoginViewModel : ViewModel() {
42
42
private val _successful = MutableLiveData (false )
43
43
val successful: LiveData <Boolean > = _successful
44
44
45
- private val _message = MutableLiveData <String >()
46
- val message: LiveData <String > = _message
45
+ val message = MutableLiveData <String >()
47
46
48
47
/* *
49
48
* Will be used to run the login method of the AuthService
@@ -64,18 +63,18 @@ class LoginViewModel : ViewModel() {
64
63
override fun onError (throwable : Throwable ) {
65
64
when (throwable) {
66
65
is IOException -> {
67
- _message .value = MentorshipApplication .getContext()
66
+ message .value = MentorshipApplication .getContext()
68
67
.getString(R .string.error_please_check_internet)
69
68
}
70
69
is TimeoutException -> {
71
- _message .value = MentorshipApplication .getContext()
70
+ message .value = MentorshipApplication .getContext()
72
71
.getString(R .string.error_request_timed_out)
73
72
}
74
73
is HttpException -> {
75
- _message .value = CommonUtils .getErrorResponse(throwable).message
74
+ message .value = CommonUtils .getErrorResponse(throwable).message
76
75
}
77
76
else -> {
78
- _message .value = MentorshipApplication .getContext()
77
+ message .value = MentorshipApplication .getContext()
79
78
.getString(R .string.error_something_went_wrong)
80
79
Log .e(tag, throwable.localizedMessage)
81
80
}
@@ -101,7 +100,7 @@ class LoginViewModel : ViewModel() {
101
100
}
102
101
103
102
fun onButtonClick () {
104
- _message .value = " "
103
+ message .value = " "
105
104
login(Login (username.value!! , password.value!! ))
106
105
}
107
106
}
0 commit comments