Stuff
import React, { useState } from 'react'; import Button from '@dailyjs/shared/components/Button'; import PropTypes from 'prop-types'; export const Splash = ({ domain, onJoin, isConfigured }) => { // const [joinAsInstructor, setJoinAsInstructor] = useState(false); const [fetching, setFetching] = useState(false); const [error, setError] = useState(false); const [room, setRoom] = useState(''); async function createRoom() { // Create a room setError(false); setFetching(true); console.log(`🚪 Creating new demo room...`); // Create a room server side (using Next JS serverless) const res = await fetch('/api/createRoom', { method: 'POST', headers: { 'Content-Type': 'application/json', }, }); const resJson = await res.json(); if (resJson.name) { setFetching(false); setRoom(resJson.name); return; } setError(resJson.error || 'An unknown error occured'); setFetching(false); } return (
Stuff