mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
17 lines
480 B
React
17 lines
480 B
React
|
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>;
|
||
|
}
|