Refactor dependency injection to use lazy loading for providers in the core configuration. Remove unused logout method from AuthViewModel and adjust ProfileViewModel to call localLogout directly from AuthRepository. Clean up constructor parameters in ProfileViewModel and TenderDetailViewModel by removing unnecessary dependencies.
This commit is contained in:
@@ -8,20 +8,16 @@ 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,
|
||||
_authViewModel = authViewModel;
|
||||
_authRepository = authRepository;
|
||||
|
||||
bool _isLoading = false;
|
||||
String? _errorMessage;
|
||||
@@ -85,7 +81,7 @@ class ProfileViewModel with ChangeNotifier {
|
||||
|
||||
switch (result) {
|
||||
case Ok<LogoutResponse>():
|
||||
await _authViewModel.localLogout();
|
||||
await _authRepository.localLogout();
|
||||
_loggedOut = true;
|
||||
break;
|
||||
case Error<LogoutResponse>():
|
||||
|
||||
Reference in New Issue
Block a user