From 00f5c8311213aa5c427a3f20ea3386115fc0fbdf Mon Sep 17 00:00:00 2001 From: Niklas Date: Tue, 18 May 2021 19:43:12 +0200 Subject: [PATCH] auto update --- src/App.jsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index badd2a1..5f96622 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -5,12 +5,15 @@ import Channel from './Channel'; function App() { let [status,setStatus] = useState([]) + async function update() { + const res = await fetch("https://node.kapelle.org/pub/ts3"); + const json = await res.json(); + setStatus(json); + } + useEffect(()=>{ - (async ()=>{ - const res = await fetch("https://node.kapelle.org/pub/ts3"); - const json = await res.json(); - setStatus(json); - })(); + setInterval(update,30000) + update() },[]); return (