import React from 'react'; import { Form, Button, Input } from 'UI'; import styles from './webhookForm.module.css'; import { useStore } from 'App/mstore'; import { observer } from 'mobx-react-lite'; import { toast } from 'react-toastify'; function WebhookForm(props) { const { settingsStore } = useStore(); const { webhookInst: webhook, hooksLoading: loading, saveWebhook, editWebhook } = settingsStore; const write = ({ target: { value, name } }) => editWebhook({ [name]: value }); const save = () => { saveWebhook(webhook) .then(() => { props.onClose(); }) .catch((e) => { const baseStr = 'Error saving webhook'; if (e.response) { e.response.json().then(({ errors }) => { toast.error(baseStr + ': ' + errors.join(',')); }); } else { toast.error(baseStr); } }); }; return (

{webhook.exists() ? 'Update' : 'Add'} Webhook

{webhook.exists() && }
{webhook.exists() && ( )}
); } export default observer(WebhookForm);