Fixed login bug after logout
This commit is contained in:
@@ -13,8 +13,8 @@ class AuthViewModel with ChangeNotifier {
|
||||
: _authRepository = authRepository {
|
||||
usernameController.addListener(_onTextChanged);
|
||||
passwordController.addListener(_onTextChanged);
|
||||
usernameFocus.addListener(_onTextChanged);
|
||||
passwordFocus.addListener(_onTextChanged);
|
||||
// usernameFocus.addListener(_onTextChanged);
|
||||
// passwordFocus.addListener(_onTextChanged);
|
||||
}
|
||||
|
||||
final TextEditingController usernameController = TextEditingController();
|
||||
@@ -58,6 +58,10 @@ class AuthViewModel with ChangeNotifier {
|
||||
switch (result) {
|
||||
case Ok<LoginResponseModel>():
|
||||
_loggedInUser = result.value.data.customer;
|
||||
usernameController.text.trim();
|
||||
passwordController.text.trim();
|
||||
usernameController.clear();
|
||||
passwordController.clear();
|
||||
break;
|
||||
case Error<LoginResponseModel>():
|
||||
_errorMessage = result.error.toString();
|
||||
@@ -70,6 +74,13 @@ class AuthViewModel with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void forceLogout() {
|
||||
_loggedInUser = null;
|
||||
usernameController.clear();
|
||||
passwordController.clear();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> logout() async {
|
||||
_errorMessage = null;
|
||||
notifyListeners();
|
||||
|
||||
Reference in New Issue
Block a user