diff --git a/src/components/sections/contact/form/index.tsx b/src/components/sections/contact/form/index.tsx index 5edef35..529c6f1 100644 --- a/src/components/sections/contact/form/index.tsx +++ b/src/components/sections/contact/form/index.tsx @@ -56,9 +56,7 @@ const CustomForm = ({ data }: FormProps) => { inquiry: selectedOption.value }) }) - .then((res) => { - // eslint-disable-next-line no-console - console.log('RESSSS', res) + .then(() => { setNotification("Thanks! We'll be in touch soon.") }) .catch((err) => console.error(err)) @@ -103,7 +101,6 @@ const CustomForm = ({ data }: FormProps) => { }) }) .then(() => { - // eslint-disable-next-line no-console setNotification("Thanks! We'll be in touch soon.") }) .catch((err) => console.error(err)) @@ -111,8 +108,9 @@ const CustomForm = ({ data }: FormProps) => { setIsSending(false) setIsFormSent(true) } catch (error) { - // eslint-disable-next-line no-console - console.log(error) + setNotification('Something went wrong') + setIsSending(false) + console.error(error) } } diff --git a/src/components/sections/partners/contact/index.tsx b/src/components/sections/partners/contact/index.tsx index 4a92e49..881145e 100644 --- a/src/components/sections/partners/contact/index.tsx +++ b/src/components/sections/partners/contact/index.tsx @@ -47,7 +47,7 @@ type FormProps = { const CustomForm = ({ data }: FormProps) => { const [selectedOption, setSelectedOption] = useState(null) - + const [notification, setNotification] = useState(null) const [name, setName] = useState('') const [email, setEmail] = useState('') const [role, setRole] = useState('') @@ -62,8 +62,6 @@ const CustomForm = ({ data }: FormProps) => { const { executeRecaptcha } = useGoogleReCaptcha() function submitEnquiryForm(gReCaptchaToken: string) { - // eslint-disable-next-line no-console - console.log('GERECAPTCHATOKEN: ', gReCaptchaToken) fetch('/api/mailchimpinquiry', { method: 'POST', body: JSON.stringify({ @@ -73,13 +71,12 @@ const CustomForm = ({ data }: FormProps) => { company: company, jurisdiction: jurisdiction, message: text, - inquiry: selectedOption.value + inquiry: selectedOption.value, + gReCaptchaToken: gReCaptchaToken }) }) - .then((res) => { - // eslint-disable-next-line no-console - console.log('RESSSS', res) - // setNotification("Thanks! We'll be in touch soon.") + .then(() => { + setNotification("Thanks! We'll be in touch soon.") }) .catch((err) => console.error(err)) } @@ -114,16 +111,6 @@ const CustomForm = ({ data }: FormProps) => { setIsSending(true) - // const data = { - // name: name, - // email: email, - // message: text, - // inquiry: selectedOption.value, - // jurisdiction: jurisdiction, - // company: company, - // role: role - // } - fetch('/api/mailchimpinquiry', { method: 'POST', body: JSON.stringify({ @@ -136,17 +123,15 @@ const CustomForm = ({ data }: FormProps) => { inquiry: selectedOption.value }) }) - .then((res) => { - // eslint-disable-next-line no-console - console.log('RESSSS', res) - // setNotification("Thanks! We'll be in touch soon.") + .then(() => { + setNotification("Thanks! We'll be in touch soon.") }) .catch((err) => console.error(err)) setIsSending(false) setIsFormSent(true) } catch (error) { - // console.log(error) + console.error(error) } } @@ -262,6 +247,7 @@ const CustomForm = ({ data }: FormProps) => { + {notification &&

{notification}

} )