import styles from './styles.module.css' import Options from "./elements/options"; import Arguments from "./elements/arguments"; import {OptionInterface} from "./elements/option"; import {ArgumentInterface} from "./elements/argument"; import {Provider} from "./context"; import {useState} from "react"; export interface CommandInterface { class: string, name: string, description: string, options: OptionInterface[], arguments: ArgumentInterface[], } export default function Command(command: CommandInterface) { const [optionList, setOptionList] = useState>({}); const [argumentList, setArgumentList] = useState>({}); let onClick = async (event: any) => { let url = `http://fmw.sipachev.sv/system-monitoring/commands/${command.name}/run` let data = { options: optionList, arguments: argumentList, } console.log('data', data) let response = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json;charset=utf-8', 'X-Plugin-Token': 'passw0rd' }, body: JSON.stringify(data) }); let result = await response.json(); console.log('result', result) } return (
{command.name} 
) }