import { createResource, onMount } from "solid-js"; import List from "../../components/list"; import RemotesService from "../../services/remotes-service"; import CreateCommandModal from "../../modals/create-command-modal"; import DeleteCommandModal from "../../modals/delete-command-modal"; function CommandsList(props) { const [commands, { refetch: refetchCommands }] = createResource( RemotesService.getCommands ); onMount(() => { refetchCommands(); }); CreateCommandModal.onCommandCreated(() => { refetchCommands(); }); DeleteCommandModal.onCommandDeleted(() => { refetchCommands(); }); function handleNewCommand() { refetchCommands(); CreateCommandModal.Handler.show(); } function handleDeleteCommand(command) { DeleteCommandModal.setCommand(command); DeleteCommandModal.Handler.show(); } return ( <>