This commit is contained in:
2025-10-28 23:46:07 +07:00
parent 73b77c27de
commit f32e1c16fb
10 changed files with 333 additions and 142 deletions

View File

@@ -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