From accc5c49e312deb03545a3c9d6aeb18ed8d53ee0 Mon Sep 17 00:00:00 2001 From: BGV <26331505+bgv2@users.noreply.github.com> Date: Sun, 30 Mar 2025 03:31:30 -0400 Subject: [PATCH] onclick still not firing --- React/src/app/page.tsx | 69 ++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/React/src/app/page.tsx b/React/src/app/page.tsx index e19cf15..c91ed2b 100644 --- a/React/src/app/page.tsx +++ b/React/src/app/page.tsx @@ -1,10 +1,8 @@ -"use client"; import { useState } from "react"; import { auth0 } from "../lib/auth0"; export default async function Home() { - const [contacts, setContacts] = useState([]); const [codeword, setCodeword] = useState(""); @@ -13,6 +11,38 @@ export default async function Home() { console.log("Session:", session?.user); + function saveToDB() { + //e.preventDefault(); + alert("Saving contacts..."); + // const contactInputs = document.querySelectorAll(".text-input") as NodeListOf; + // const contactValues = Array.from(contactInputs).map(input => input.value); + // console.log("Contact values:", contactValues); + // // save codeword and contacts to database + // fetch("/api/databaseStorage", { + // method: "POST", + // headers: { + // "Content-Type": "application/json", + // }, + // body: JSON.stringify({ + // email: session?.user?.email || "", + // codeword: (document.getElementById("codeword") as HTMLInputElement)?.value, + // contacts: contactValues, + // }), + // }) + // .then((response) => { + // if (response.ok) { + // alert("Contacts saved successfully!"); + // } else { + // alert("Error saving contacts."); + // } + // }) + // .catch((error) => { + // console.error("Error:", error); + // alert("Error saving contacts."); + // }); + + } + // If no session, show sign-up and login buttons if (!session) { @@ -134,38 +164,9 @@ export default async function Home() { className="bg-emerald-500 text-fuchsia-300" type="button">Add -
@@ -181,4 +182,6 @@ export default async function Home() {
); + + }