import { h } from 'preact'; import { ApiHost } from './context'; import Heading from './components/Heading'; import { useContext, useEffect, useState } from 'preact/hooks'; export default function Event({ eventId }) { const apiHost = useContext(ApiHost); const [data, setData] = useState(null); useEffect(async () => { const response = await fetch(`${apiHost}/api/events/${eventId}`); const data = response.ok ? await response.json() : null; setData(data); }, [apiHost, eventId]); if (!data) { return (
loading…
{data.has_clip ? (
) : (
No clip available
)}{JSON.stringify(data, null, 2)}