"use client"; import Link from "next/link"; import { useState } from "react"; export default function Home() { const [starting, setStarting] = useState(false); const [roomUrl, setRoomUrl] = useState(); async function start() { setStarting(true); const resp = await fetch( `${process.env.API_URL || "http://localhost:8000"}/start`, { method: "POST", mode: "cors", cache: "no-cache", credentials: "same-origin", headers: { "Content-Type": "application/json", }, body: JSON.stringify({}), } ); const data = await resp.json(); setRoomUrl(data.room_url); } return (
{!starting ? ( ) : (
{roomUrl ? ( Open Room ) : ( "Waiting for bot to load..." )}
)}
); }