merged call page

This commit is contained in:
idler-wheel
2025-03-30 07:38:22 -04:00
4 changed files with 337 additions and 44 deletions

View File

@@ -69,6 +69,25 @@ function CallPage() {
audio.play();
};
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">
@@ -94,7 +113,7 @@ function CallPage() {
</>
)}
<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

@@ -1,8 +1,14 @@
"use client";
import { useState } from "react";
import { auth0 } from "../lib/auth0";
import { NextApiRequest, NextApiResponse } from "next";
export default async function Home() {
const [contacts, setContacts] = useState<string[]>([]);
const [codeword, setCodeword] = useState("");
@@ -10,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) {