import {Table, TableBody, TableCell, TableHead, TableRow} from "@mui/material"; import Command, {CommandInterface} from "./elements/command"; import {useEffect, useState} from "react"; export default function Commands() { const [commands, setCommands] = useState([]); let refreshCommands = async () => { let response = await fetch('http://fmw.sipachev.sv/system-monitoring/commands', { method: 'GET', headers: { 'Content-Type': 'application/json;charset=utf-8', 'X-Plugin-Token': 'passw0rd' }, }); const commands: CommandInterface[] = await response.json() setCommands(commands) setTimeout(() => refreshCommands, 1000) } useEffect(() => { refreshCommands() }, []) return ( Name Action {commands.map((command: CommandInterface, index: number) => ( ))}
) }