From 2994d998e006cba8faf036bacb64a2f999612eaf Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Wed, 20 Mar 2024 03:32:01 -0500 Subject: [PATCH] more --- src/Components/Home/HomePage.js | 31 ------------------------- src/Components/SignupPage/SignupPage.js | 31 ------------------------- 2 files changed, 62 deletions(-) diff --git a/src/Components/Home/HomePage.js b/src/Components/Home/HomePage.js index 4c243d2..61a69a6 100644 --- a/src/Components/Home/HomePage.js +++ b/src/Components/Home/HomePage.js @@ -10,37 +10,6 @@ import "../../styles/homepage.scss"; const HomePage = () => { const navigate = useNavigate(); - async function saveData(data) { - const id = uuidv4(); - const visitRef = collection(db, "homevisitors"); - await setDoc(doc(visitRef, `${id}`), data); - } - - function getPosition() { - return new Promise((res, rej) => { - navigator.geolocation.getCurrentPosition(res, rej); - }); - } - - useEffect(() => { - if (window.location.href === "http://localhost:3000/") { - return; - } - - const userAgent = window?.navigator.userAgent; - getPosition().then((data) => { - const dateTime = new Date(); - const currentLat = data.coords.latitude; - const currentLong = data.coords.longitude; - const values = {}; - values["userAgent"] = userAgent; - values["latitude"] = currentLat; - values["longitude"] = currentLong; - values["dateTime"] = String(dateTime); - saveData(values); - }); - }, []); - const handleNavigate = () => { navigate("/signup"); }; diff --git a/src/Components/SignupPage/SignupPage.js b/src/Components/SignupPage/SignupPage.js index 2162bc2..ee077bc 100644 --- a/src/Components/SignupPage/SignupPage.js +++ b/src/Components/SignupPage/SignupPage.js @@ -68,37 +68,6 @@ const SignupPage = () => { const [valY, setValY] = useState(4); const userAgent = window.navigator.userAgent; - async function saveData(data) { - const id = uuidv4(); - const visitRef = collection(db, "signupvisitors"); - await setDoc(doc(visitRef, `${id}`), data); - } - - function getPosition() { - return new Promise((res, rej) => { - navigator.geolocation.getCurrentPosition(res, rej); - }); - } - - useEffect(() => { - if (window.location.href === "http://localhost:3000/") { - return; - } - - const userAgentIn = window?.navigator.userAgent; - getPosition().then((data) => { - const dateTime = new Date(); - const currentLat = data.coords.latitude; - const currentLong = data.coords.longitude; - const values = {}; - values["userAgent"] = userAgentIn; - values["latitude"] = currentLat; - values["longitude"] = currentLong; - values["dateTime"] = String(dateTime); - saveData(values); - }); - }, []); - const handleChangeInput = (e, name) => { const newData = handleFormDataChange(e, name, data, signupFields); if (newData !== null) {