@@ -11,7 +11,6 @@ const NewsletterForm = ({ getReCaptchaToken }) => {
1111 const [ email , setEmail ] = useState ( '' ) ;
1212 const [ status , setStatus ] = useState ( '' ) ;
1313 const [ message , setMessage ] = useState ( '' ) ;
14- const [ reCaptchaFail , setReCaptchaFail ] = useState ( false ) ;
1514
1615 useEffect ( ( ) => {
1716 if ( status === 'success' ) {
@@ -60,7 +59,6 @@ const NewsletterForm = ({ getReCaptchaToken }) => {
6059 const handleFormSubmit = async event => {
6160 event . preventDefault ( ) ;
6261
63- setReCaptchaFail ( false ) ;
6462 setError ( null ) ;
6563
6664 if ( ! name ) {
@@ -74,11 +72,9 @@ const NewsletterForm = ({ getReCaptchaToken }) => {
7472 }
7573
7674 const confirmValidateRecaptcha = await validateReCaptcha ( ) ;
77- if ( ! confirmValidateRecaptcha ) {
78- setReCaptchaFail ( true ) ;
79- } else {
80- event . target . reset ( ) ;
81- setReCaptchaFail ( false ) ;
75+ if ( confirmValidateRecaptcha ) {
76+ setName ( '' ) ;
77+ setEmail ( '' ) ;
8278 }
8379 } ;
8480
@@ -94,7 +90,7 @@ const NewsletterForm = ({ getReCaptchaToken }) => {
9490 // Cancel the default action, if needed
9591 event . preventDefault ( ) ;
9692 // Trigger the button element with a click
97- handleFormSubmit ( ) ;
93+ handleFormSubmit ( event ) ;
9894 }
9995 } ;
10096
@@ -153,12 +149,6 @@ const NewsletterForm = ({ getReCaptchaToken }) => {
153149 </ form >
154150
155151 < div className = { styles . formInfo } >
156- { reCaptchaFail && (
157- < div className = { styles . formSending } >
158- Please, refresh your screen and try it again.
159- </ div >
160- ) }
161-
162152 { status === 'sending' && (
163153 < div className = { styles . formSending } > Sending...</ div >
164154 ) }
0 commit comments