aiuto
This commit is contained in:
@@ -1,26 +1,35 @@
|
||||
part of 'auth_bloc.dart';
|
||||
part of 'auth_cubit.dart';
|
||||
|
||||
enum AuthStatus { initial, loading, success, failure }
|
||||
enum AuthStatus { initial, loading, failure }
|
||||
|
||||
class AuthState extends Equatable {
|
||||
final AuthStatus status;
|
||||
final bool isLoginMode;
|
||||
final String? errorMessage;
|
||||
final String? infoMessage;
|
||||
|
||||
const AuthState({
|
||||
required this.status,
|
||||
this.error,
|
||||
required this.isLoginMode,
|
||||
this.status = AuthStatus.initial,
|
||||
this.isLoginMode = true,
|
||||
this.errorMessage,
|
||||
this.infoMessage,
|
||||
});
|
||||
|
||||
final AuthStatus status;
|
||||
final String? error;
|
||||
final bool isLoginMode;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [status, error, isLoginMode];
|
||||
|
||||
AuthState copyWith({AuthStatus? status, String? error, bool? isLoginMode}) {
|
||||
AuthState copyWith({
|
||||
AuthStatus? status,
|
||||
bool? isLoginMode,
|
||||
String? errorMessage,
|
||||
String? infoMessage,
|
||||
}) {
|
||||
return AuthState(
|
||||
status: status ?? this.status,
|
||||
error: error,
|
||||
isLoginMode: isLoginMode ?? this.isLoginMode,
|
||||
// Se non passo esplicitamente un errore, lo resetto per evitare che rimanga bloccato a schermo
|
||||
errorMessage: errorMessage,
|
||||
infoMessage: infoMessage,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [status, isLoginMode, errorMessage, infoMessage];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user