Skip to content

Commit

Permalink
fix(core): fix for contact us form recaptcha (#657)
Browse files Browse the repository at this point in the history
  • Loading branch information
bc-alexsaiannyi committed Mar 18, 2024
1 parent 35e5c96 commit 801bead
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions apps/core/components/forms/contact-us.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Loader2 as Spinner } from 'lucide-react';
import { useTranslations } from 'next-intl';
import { ChangeEvent, useRef, useState } from 'react';
import { useFormStatus } from 'react-dom';
import { ReCAPTCHA } from 'react-google-recaptcha';
import ReCaptcha from 'react-google-recaptcha';

import { submitContactForm } from './_actions/submit-contact-form';

Expand Down Expand Up @@ -74,13 +74,13 @@ export const ContactUs = ({ fields, pageEntityId, reCaptchaSettings }: ContactUs
const [formStatus, setFormStatus] = useState<FormStatus | null>(null);
const [isTextFieldValid, setTextFieldValidation] = useState(true);
const [isInputValid, setInputValidation] = useState(true);
const reCaptchaRef = useRef<ReCAPTCHA>(null);
const reCaptchaRef = useRef<ReCaptcha>(null);
const [reCaptchaToken, setReCaptchaToken] = useState('');
const [isReCaptchaValid, setReCaptchaValid] = useState(true);

const t = useTranslations('AboutUs');

const onReCatpchaChange = (token: string | null) => {
const onReCaptchaChange = (token: string | null) => {
if (!token) {
return setReCaptchaValid(false);
}
Expand Down Expand Up @@ -204,8 +204,8 @@ export const ContactUs = ({ fields, pageEntityId, reCaptchaSettings }: ContactUs
</>
{reCaptchaSettings?.isEnabledOnStorefront && (
<Field className="relative col-span-full max-w-full space-y-2 pb-7" name="ReCAPTCHA">
<ReCAPTCHA
onChange={onReCatpchaChange}
<ReCaptcha
onChange={onReCaptchaChange}
ref={reCaptchaRef}
sitekey={reCaptchaSettings.siteKey}
/>
Expand Down

0 comments on commit 801bead

Please sign in to comment.