import { Button } from "@mantine/core"; import { IconArrowRight, IconChevronRight } from "@tabler/icons-react"; import { useState } from "react"; import { apiUrl } from "../utils"; export default function CreateRoom({ onCreateRoom }) { const [fetching, setFetching] = useState(false); const [roomUrl, setRoomUrl] = useState(); const [showManual, setShowManual] = useState(false); async function create() { setFetching(true); const resp = await fetch(`${apiUrl}/create`, { method: "POST", mode: "cors", cache: "no-cache", credentials: "same-origin", headers: { "Content-Type": "application/json", }, }); const data = await resp.json(); if (!data.room_url) { setFetching(false); console.log("error creating room"); } onCreateRoom(data.room_url); } return (
Explanation goes here