idle
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import '../session/session_bloc.dart';
|
||||
import '../session/session_event.dart';
|
||||
import '../session/session_state.dart';
|
||||
import 'auth_event.dart';
|
||||
import 'auth_state.dart';
|
||||
import '../../services/api_client.dart';
|
||||
@@ -252,11 +253,12 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
CheckAuthRequested event,
|
||||
Emitter<AuthState> emit,
|
||||
) async {
|
||||
// Try to restore session from persistent storage
|
||||
// Check if session is active from persistent storage
|
||||
final sessionState = sessionBloc.state;
|
||||
|
||||
if (sessionState is SessionActive) {
|
||||
// Session already active
|
||||
// Session already active - emit authenticated state with minimal info
|
||||
// The full user info will be fetched when needed
|
||||
emit(AuthAuthenticated(
|
||||
token: sessionState.token,
|
||||
userId: '',
|
||||
@@ -264,8 +266,6 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
email: '',
|
||||
));
|
||||
} else {
|
||||
// Try to restore from SharedPreferences
|
||||
await Future.delayed(const Duration(milliseconds: 100)); // Give time for restoration
|
||||
emit(AuthUnauthenticated());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user