auto update
This commit is contained in:
parent
8ecd016eda
commit
00f5c83112
13
src/App.jsx
13
src/App.jsx
@ -5,12 +5,15 @@ import Channel from './Channel';
|
|||||||
function App() {
|
function App() {
|
||||||
let [status,setStatus] = useState([])
|
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(()=>{
|
useEffect(()=>{
|
||||||
(async ()=>{
|
setInterval(update,30000)
|
||||||
const res = await fetch("https://node.kapelle.org/pub/ts3");
|
update()
|
||||||
const json = await res.json();
|
|
||||||
setStatus(json);
|
|
||||||
})();
|
|
||||||
},[]);
|
},[]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user