texting works

This commit is contained in:
BGV
2025-03-30 01:15:48 -04:00
parent 688076c40a
commit 2d8ac95978
2 changed files with 20 additions and 18 deletions

View File

@@ -12,6 +12,25 @@ const CallPage = () => {
return () => clearInterval(interval);
}, []);
const handleEmergency = async () => {
// send texts
const response = await fetch("/api/sendMessage", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
message: `yo i need help`,
}),
});
if (!response.ok) {
console.error("Error sending message:", response.statusText);
return;
}
}
return (
<div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
<main className="flex flex-col gap-[32px] row-start-2 items-center sm:items-start">
@@ -19,7 +38,7 @@ const CallPage = () => {
Call with a Definitely Real Person</h1>
<div className="text-2xl font-bold">{callDuration}s</div>
<button className="bg-red-500 text-white rounded-md p-2">Emergency</button>
<button onClick={handleEmergency} className="bg-red-500 text-white rounded-md p-2">Emergency</button>
<button className="bg-blue-500 text-white rounded-md p-2"
onClick={() => {
window.location.href = '/';

View File

@@ -16,23 +16,6 @@ export default async function Home() {
console.log("Session:", session?.user);
const handleEmergency = async () => {
// send texts
const response = await fetch("/api/sendMessage", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
message: `yo i need help`,
}),
});
if (!response.ok) {
console.error("Error sending message:", response.statusText);
return;
}
}
// If no session, show sign-up and login buttons
if (!session) {