fix(auth): update form plugin and fix auth
This commit is contained in:
+1
-1
@@ -33,7 +33,7 @@ class PasswordResetCubit extends Cubit<PasswordResetState> {
|
||||
emit(
|
||||
state.copyWith(
|
||||
email: email,
|
||||
status: FormData.validate([email]),
|
||||
status: FormStatus.validate([email]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class SignInCubit extends Cubit<SignInState> {
|
||||
emit(
|
||||
state.copyWith(
|
||||
email: email,
|
||||
status: FormData.validate([email, state.password]),
|
||||
status: FormStatus.validate([email, state.password]),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ class SignInCubit extends Cubit<SignInState> {
|
||||
emit(
|
||||
state.copyWith(
|
||||
password: password,
|
||||
status: FormData.validate([state.email, password]),
|
||||
status: FormStatus.validate([state.email, password]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -44,16 +44,16 @@ class SignUpCubit extends Cubit<SignUpState> {
|
||||
void emailChanged(String value) {
|
||||
final Email email = Email.dirty(value);
|
||||
|
||||
final List<FormInput<dynamic, ValidationError>> inputsToValidate = [
|
||||
final List<FormInputValidator<dynamic, ValidationError>> toValidate = [
|
||||
email,
|
||||
state.password,
|
||||
...state.data.inputs<dynamic>(),
|
||||
...state.data.validators<dynamic, ValidationError>(),
|
||||
];
|
||||
|
||||
emit(
|
||||
state.copyWith(
|
||||
email: email,
|
||||
status: FormData.validate(inputsToValidate),
|
||||
status: FormStatus.validate(toValidate),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -61,26 +61,26 @@ class SignUpCubit extends Cubit<SignUpState> {
|
||||
void passwordChanged(String value) {
|
||||
final Password password = Password.dirty(value);
|
||||
|
||||
final List<FormInput<dynamic, ValidationError>> inputsToValidate = [
|
||||
final List<FormInputValidator<dynamic, ValidationError>> toValidate = [
|
||||
state.email,
|
||||
password,
|
||||
...state.data.inputs<dynamic>(),
|
||||
...state.data.validators<dynamic, ValidationError>(),
|
||||
];
|
||||
|
||||
emit(
|
||||
state.copyWith(
|
||||
password: password,
|
||||
status: FormData.validate(inputsToValidate),
|
||||
status: FormStatus.validate(toValidate),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Take from wyatt_form_bloc/wyatt_form_bloc.dart
|
||||
void dataChanged<T>(String field, FormInput dirtyValue) {
|
||||
void dataChanged<T>(String field, FormInputValidator dirtyValue) {
|
||||
final _form = state.data.clone();
|
||||
|
||||
if (_form.contains(field)) {
|
||||
_form.update(field, dirtyValue);
|
||||
_form.updateValidator(field, dirtyValue);
|
||||
} else {
|
||||
throw Exception('Form field $field not found');
|
||||
}
|
||||
@@ -88,8 +88,12 @@ class SignUpCubit extends Cubit<SignUpState> {
|
||||
emit(
|
||||
state.copyWith(
|
||||
data: _form,
|
||||
status: FormData.validate(
|
||||
[state.email, state.password, ..._form.inputs<dynamic>()],
|
||||
status: FormStatus.validate(
|
||||
[
|
||||
state.email,
|
||||
state.password,
|
||||
...state.data.validators<dynamic, ValidationError>(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -120,8 +124,12 @@ class SignUpCubit extends Cubit<SignUpState> {
|
||||
emit(
|
||||
state.copyWith(
|
||||
data: _form,
|
||||
status: FormData.validate(
|
||||
[state.email, state.password, ..._form.inputs<dynamic>()],
|
||||
status: FormStatus.validate(
|
||||
[
|
||||
state.email,
|
||||
state.password,
|
||||
...state.data.validators<dynamic, ValidationError>(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user