fix
This commit is contained in:
@@ -129,24 +129,11 @@ class AuthNotifier extends StateNotifier<AuthState> {
|
||||
///
|
||||
/// Clears authentication data and returns to initial state
|
||||
Future<void> logout() async {
|
||||
// Set loading state
|
||||
state = state.copyWith(isLoading: true, error: null);
|
||||
// Clear tokens from secure storage
|
||||
await logoutUseCase();
|
||||
|
||||
// Call logout use case
|
||||
final result = await logoutUseCase();
|
||||
|
||||
// Handle result
|
||||
result.fold(
|
||||
(failure) {
|
||||
// Logout failed - but still reset to initial state
|
||||
// (local data should be cleared even if API call fails)
|
||||
state = const AuthState.initial();
|
||||
},
|
||||
(_) {
|
||||
// Logout successful - reset to initial state
|
||||
state = const AuthState.initial();
|
||||
},
|
||||
);
|
||||
// Always reset to initial state (clear local data even if API call fails)
|
||||
state = const AuthState.initial();
|
||||
}
|
||||
|
||||
/// Check authentication status on app start
|
||||
|
||||
Reference in New Issue
Block a user