Reviewed-on: #12 Co-authored-by: Mark M2 Macbook <marco@catelli.it> Co-committed-by: Mark M2 Macbook <marco@catelli.it>
36 lines
896 B
Dart
36 lines
896 B
Dart
part of 'auth_cubit.dart';
|
|
|
|
enum AuthStatus { initial, pwResetSent, loading, failure }
|
|
|
|
class AuthState extends Equatable {
|
|
final AuthStatus status;
|
|
final bool isLoginMode;
|
|
final String? errorMessage;
|
|
final AppMessage? infoMessage;
|
|
|
|
const AuthState({
|
|
this.status = AuthStatus.initial,
|
|
this.isLoginMode = true,
|
|
this.errorMessage,
|
|
this.infoMessage,
|
|
});
|
|
|
|
AuthState copyWith({
|
|
AuthStatus? status,
|
|
bool? isLoginMode,
|
|
String? errorMessage,
|
|
AppMessage? infoMessage,
|
|
}) {
|
|
return AuthState(
|
|
status: status ?? this.status,
|
|
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];
|
|
}
|