"use client"; import ReCAPTCHA from "react-google-recaptcha"; import { useState, useRef } from "react"; export default function Callback1() { const [domain, setDomain] = useState(""); const [email, setEmail] = useState(""); const [captchaValue, setCaptchaValue] = useState(null); const [isLoading, setIsLoading] = useState(false); const recaptchaRef = useRef(null); const handleChange = ({ target: { name, value } }) => { if (name === "domain") { setDomain(value); } else if (name === "email") { setEmail(value); } }; const handleCaptchaChange = (value) => { setCaptchaValue(value); }; const handleSubmit = async (event) => { event.preventDefault(); setIsLoading(true); try { const response = await fetch("/api/verifyreport", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ domain, email, captcha: captchaValue }), }); const data = await response.json(); if (response.ok) { sessionStorage.setItem("reportData", JSON.stringify({ domain, email })); const getReport = await fetch("/api/getreport", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ websitename: domain, emailname: email }), }); const reportResult = await getReport.json(); if (getReport.ok) { try { const cryagentResponse = await fetch( "https://cryagent.pythonanywhere.com/submitrankrunnerschecker", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ email: email }), } ); if (!cryagentResponse.ok) { console.error("Failed to submit to cryagent.pythonanywhere.com"); } } catch (cryagentError) { console.error( "Error submitting to cryagent.pythonanywhere.com:", cryagentError ); } sessionStorage.setItem("reportResult", JSON.stringify(reportResult)); window.location.href = "/report"; } else { console.error("API response:", reportResult); alert(reportResult.message); } } else { console.error("API response:", data); alert(data.message); } setIsLoading(false); } catch (error) { console.error("Error submitting form:", error); alert("An error occurred. Please try again later."); setIsLoading(false); } }; return ( <>

Check your website's SEO performance

{/* */}
{!isLoading && ( )} {isLoading && ( )}
); }