import React, { useState } from "react"; import { useMediaQuery } from "react-responsive"; import { Form, Input, Button, Card, Flex, message } from "antd"; import TurnstileModal from "../components/TurnstileModal"; import { ArrowRightOutlined } from "@ant-design/icons"; const ContactView = ({ setCurrentView }) => { const isMobile = useMediaQuery({ maxWidth: 600 }); const [turnstileOpen, setTurnstileOpen] = useState(false); const [email, setEmail] = useState(""); const handleSubmit = async (token) => { if (!token) { setTurnstileOpen(true); // Open Turnstile modal return; } console.log("Got token", token); console.log("Got email", email); try { const response = await fetch("https://web.tombutcher.work/api/contact", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ email, token }), }); const data = await response.json(); if (data.success) { message.success("Message sent successfully!"); } else { message.error("Verification failed. Try again."); } } catch (error) { message.error("Error sending request."); } }; return (
Enter your email below and I will be in contact:
I'm often busy, but I'll make sure to get back to you within 48 hours!
By clicking the submit button, you consent to your email address and certain browser-related details (such as an approximate geographical location based on your IP) being sent exclusively to me via email.