Skip to content

Commit

Permalink
remove emailOpt in from the data as well as the UI so errors work again
Browse files Browse the repository at this point in the history
  • Loading branch information
jms301 committed Mar 27, 2024
1 parent ca28883 commit 01a670f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions app/constituencies/[slug]/SignupShare.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ const emailErrorMessage = (code: EmailErrorCode) => {
};

type FormData = {
emailOptIn: boolean;
email: string;
};

const initialFormState: FormData = {
emailOptIn: false,
email: "",
};

Expand Down Expand Up @@ -93,9 +91,8 @@ export default function SignupShare({
// VALIDATION
// Invalid email
if (
formState.emailOptIn &&
(!formState.email ||
(formRef.current && formRef.current.email.validity.typeMismatch))
!formState.email ||
(formRef.current && formRef.current.email.validity.typeMismatch)
) {
setEmailError("EMAIL_INVALID");
}
Expand Down Expand Up @@ -154,7 +151,7 @@ export default function SignupShare({
name="email"
size="lg"
type="email"
placeholder="Your Email"
placeholder="Your Email*"
value={formState.email}
isInvalid={!!emailError}
onChange={(e) => {
Expand Down

0 comments on commit 01a670f

Please sign in to comment.