Skip to content

Commit

Permalink
ui: landing_page: access form: separate schema for anon user
Browse files Browse the repository at this point in the history
  • Loading branch information
yashlamba authored and zzacharo committed Oct 16, 2023
1 parent 45c4953 commit 65a76d0
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ export class AccessRequestForm extends Component {
message: Yup.string().nullable(),
consent_to_share_personal_data: Yup.bool().required(),
});

this.anonymousAccessRequestSchema = Yup.object({
email: Yup.string().email().nullable().required(),
full_name: Yup.string().nullable().required(),
message: Yup.string().nullable(),
consent_to_share_personal_data: Yup.bool().required(),
});
}

componentWillUnmount() {
Expand Down Expand Up @@ -113,7 +120,9 @@ export class AccessRequestForm extends Component {
onSubmit={this.handleSubmit}
enableReinitialize
initialValues={this.initFormValues()}
validationSchema={this.accessRequestSchema}
validationSchema={
isAnonymous ? this.anonymousAccessRequestSchema : this.accessRequestSchema
}
validateOnChange={false}
validateOnBlur={false}
>
Expand Down

0 comments on commit 65a76d0

Please sign in to comment.