fixed login bug
This commit is contained in:
@@ -8,16 +8,20 @@ import '../core/utils/result.dart';
|
||||
import '../data/repositories/profile_repository.dart';
|
||||
import '../data/services/model/logout_response/logout_response.dart';
|
||||
import '../data/services/model/profile_response/profile_response.dart';
|
||||
import 'auth_view_model.dart';
|
||||
|
||||
class ProfileViewModel with ChangeNotifier {
|
||||
final ProfileRepository _profileRepository;
|
||||
final AuthRepository _authRepository;
|
||||
final AuthViewModel _authViewModel;
|
||||
|
||||
ProfileViewModel({
|
||||
required ProfileRepository profileRepository,
|
||||
required AuthRepository authRepository,
|
||||
required AuthViewModel authViewModel,
|
||||
}) : _profileRepository = profileRepository,
|
||||
_authRepository = authRepository {
|
||||
_authRepository = authRepository,
|
||||
_authViewModel = authViewModel {
|
||||
getCompanyProfile();
|
||||
}
|
||||
|
||||
@@ -81,7 +85,7 @@ class ProfileViewModel with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> logout(BuildContext context) async {
|
||||
Future<void> logout() async {
|
||||
_errorMessage = null;
|
||||
notifyListeners();
|
||||
|
||||
@@ -89,13 +93,15 @@ class ProfileViewModel with ChangeNotifier {
|
||||
|
||||
switch (result) {
|
||||
case Ok<LogoutResponse>():
|
||||
localLogout();
|
||||
_authViewModel.localLogout();
|
||||
_loggedOut = true;
|
||||
break;
|
||||
case Error<LogoutResponse>():
|
||||
_errorMessage = result.error.toString();
|
||||
break;
|
||||
}
|
||||
|
||||
notifyListeners();
|
||||
_errorMessage = null;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user