diff --git a/packages/web/components/elements/Recaptcha.tsx b/packages/web/components/elements/Recaptcha.tsx new file mode 100644 index 000000000..193ada581 --- /dev/null +++ b/packages/web/components/elements/Recaptcha.tsx @@ -0,0 +1,19 @@ +import { GoogleReCaptchaCheckbox } from '@google-recaptcha/react' + +type RecaptchaProps = { + setRecaptchaToken: (token: string) => void +} + +export const Recaptcha = (props: RecaptchaProps): JSX.Element => { + return ( + <> + { + console.log('recaptcha: ', token) + props.setRecaptchaToken(token) + }} + /> + + ) +} diff --git a/packages/web/components/templates/auth/EmailSignup.tsx b/packages/web/components/templates/auth/EmailSignup.tsx index 79771f308..92a4527c6 100644 --- a/packages/web/components/templates/auth/EmailSignup.tsx +++ b/packages/web/components/templates/auth/EmailSignup.tsx @@ -10,19 +10,17 @@ import { logoutMutation } from '../../../lib/networking/mutations/logoutMutation import { useRouter } from 'next/router' import { formatMessage } from '../../../locales/en/messages' import { parseErrorCodes } from '../../../lib/queryParamParser' -import { - GoogleReCaptchaProvider, - GoogleReCaptchaCheckbox, -} from '@google-recaptcha/react' import Link from 'next/link' +import { Recaptcha } from '../../elements/Recaptcha' const SignUpForm = (): JSX.Element => { const [email, setEmail] = useState() const [password, setPassword] = useState() const [fullname, setFullname] = useState() const [username, setUsername] = useState() - const [debouncedUsername, setDebouncedUsername] = - useState() + const [debouncedUsername, setDebouncedUsername] = useState< + string | undefined + >() const { isUsernameValid, usernameErrorMessage } = useValidateUsernameQuery({ username: debouncedUsername ?? '', @@ -126,24 +124,6 @@ const SignUpForm = (): JSX.Element => { ) } -type RecaptchaProps = { - setRecaptchaToken: (token: string) => void -} - -const Recaptcha = (props: RecaptchaProps): JSX.Element => { - return ( - <> - { - console.log('recaptcha: ', token) - props.setRecaptchaToken(token) - }} - /> - - ) -} - export function EmailSignup(): JSX.Element { const router = useRouter() const recaptchaTokenRef = useRef(null)