import { h } from 'preact'; import Camera from './Camera'; import CameraMap from './CameraMap'; import Cameras from './Cameras'; import Debug from './Debug'; import Event from './Event'; import Events from './Events'; import { Router } from 'preact-router'; import Sidebar from './Sidebar'; import { ApiHost, Config } from './context'; import { useContext, useEffect, useState } from 'preact/hooks'; export default function App() { const apiHost = useContext(ApiHost); const [config, setConfig] = useState(null); useEffect(async () => { const response = await fetch(`${apiHost}/api/config`); const data = response.ok ? await response.json() : {}; setConfig(data); }, []); return !config ? (
) : (
); return; }