feat!: web user interface

This commit is contained in:
Paul Armstrong
2021-01-09 09:26:46 -08:00
committed by Blake Blackshear
parent 5ad4017510
commit c618867941
29 changed files with 9112 additions and 123 deletions

16
web/src/Debug.jsx Normal file
View File

@@ -0,0 +1,16 @@
import { h } from 'preact';
import { ApiHost } from './context';
import { useContext, useEffect, useState } from 'preact/hooks';
export default function Debug() {
const apiHost = useContext(ApiHost);
const [config, setConfig] = useState({});
useEffect(async () => {
const response = await fetch(`${apiHost}/api/stats`);
const data = response.ok ? await response.json() : {};
setConfig(data);
}, []);
return <pre>{JSON.stringify(config, null, 2)}</pre>;
}