import React, { useEffect } from 'react'; import { Loader, NoContent, Icon } from 'UI'; import WebhookForm from './WebhookForm'; import AnimatedSVG, { ICONS } from 'Shared/AnimatedSVG/AnimatedSVG'; import { toast } from 'react-toastify'; import { useStore } from 'App/mstore'; import { observer } from 'mobx-react-lite'; import { IWebhook } from 'Types/webhook'; import { App, List, Button, Typography, Space } from 'antd'; import { PencilIcon } from '.store/lucide-react-virtual-b029c146a4/package'; import usePageTitle from '@/hooks/usePageTitle'; import { useModal } from 'Components/ModalContext'; function Webhooks() { const { settingsStore } = useStore(); const { webhooks, hooksLoading: loading } = settingsStore; const { openModal, closeModal } = useModal(); const { modal } = App.useApp(); usePageTitle('Webhooks - OpenReplay Preferences'); const customWebhooks = webhooks.filter((h) => h.type === 'webhook'); useEffect(() => { void settingsStore.fetchWebhooks(); }, []); const init = (w?: Partial) => { settingsStore.initWebhook({...w}); openModal(, { title: w ? 'Edit Webhook' : 'Add Webhook' }); }; const removeWebhook = async (id: string) => { modal.confirm({ title: 'Confirm', content: 'Are you sure you want to remove this webhook?', onOk: () => { settingsStore.removeWebhook(id).then(() => toast.success('Webhook removed successfully')); closeModal(); } }); }; return (
Webhooks Leverage webhook notifications on alerts to trigger custom callbacks.
None added yet
} size="small" show={customWebhooks.length === 0} > ( init(w)} className="p-2! group flex justify-between items-center cursor-pointer hover:bg-active-blue transition" > {w.name} {w.endpoint}