import React, { useEffect } from 'react'; import cn from 'classnames'; import withPageTitle from 'HOCs/withPageTitle'; import { Button, Loader, NoContent, Icon, Divider } from 'UI'; import WebhookForm from './WebhookForm'; import ListItem from './ListItem'; import styles from './webhooks.module.css'; import AnimatedSVG, { ICONS } from 'Shared/AnimatedSVG/AnimatedSVG'; import { confirm } from 'UI'; import { toast } from 'react-toastify'; import { useModal } from 'App/components/Modal'; import { useStore } from 'App/mstore'; import { observer } from 'mobx-react-lite' import { IWebhook } from 'Types/webhook'; function Webhooks() { const { settingsStore } = useStore() const { webhooks, hooksLoading: loading } = settingsStore; const { showModal, hideModal } = useModal(); const customWebhooks = webhooks.filter((hook) => hook.type === 'webhook'); useEffect(() => { void settingsStore.fetchWebhooks(); }, []); const init = (webhookInst?: Partial) => { settingsStore.initWebhook(webhookInst); showModal(, { right: true }); }; const removeWebhook = async (id: string) => { if ( await confirm({ header: 'Confirm', confirmButton: 'Yes, delete', confirmation: `Are you sure you want to remove this webhook?`, }) ) { settingsStore.removeWebhook(id).then(() => { toast.success('Webhook removed successfully'); }); hideModal(); } }; return (

{'Webhooks'}

Leverage webhook notifications on alerts to trigger custom callbacks.
None added yet
} size="small" show={customWebhooks.length === 0} >
{customWebhooks.map((webhook) => ( <> init(webhook)} /> ))}
); } export default withPageTitle('Webhooks - OpenReplay Preferences')(observer(Webhooks));