import React from "react"; import type { NextPage } from "next"; import { useRouter } from "next/router"; import useSWR from "swr"; import { observer } from "mobx-react-lite"; // layout import { AppLayout } from "layouts/app-layout"; import { WorkspaceSettingLayout } from "layouts/settings-layout"; // components import { WorkspaceSettingHeader } from "components/headers"; import { WebhookLists, EmptyWebhooks } from "components/web-hooks"; // hooks import { useMobxStore } from "lib/mobx/store-provider"; // types import { RootStore } from "store/root"; import { Spinner } from "@plane/ui"; const WebhooksPage: NextPage = observer(() => { const router = useRouter(); const { workspaceSlug } = router.query as { workspaceSlug: string }; const { webhook: { fetchWebhooks, webhooks, loader }, }: RootStore = useMobxStore(); useSWR( workspaceSlug ? `WEBHOOKS_LIST_${workspaceSlug}` : null, workspaceSlug ? () => fetchWebhooks(workspaceSlug) : null ); return ( }> {loader ? ( ) : ( <> {Object.keys(webhooks).length > 0 ? ( ) : ( )} > )} ); }); export default WebhooksPage;