import React from "react"; import Link from "next/link"; import { useRouter } from "next/router"; import useSWR from "swr"; import { observer } from "mobx-react-lite"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; // layouts import { AppLayout } from "layouts/app-layout"; import { WorkspaceSettingLayout } from "layouts/settings-layout"; // components import { WorkspaceSettingHeader } from "components/headers"; import { WebhooksList, WebhooksEmptyState } from "components/web-hooks"; // ui import { Button, Spinner } from "@plane/ui"; // types import { NextPageWithLayout } from "types/app"; const WebhooksListPage: NextPageWithLayout = observer(() => { const router = useRouter(); const { workspaceSlug } = router.query; const { webhook: { fetchWebhooks, webhooks }, user: { currentWorkspaceRole }, } = useMobxStore(); const isAdmin = currentWorkspaceRole === 20; useSWR( workspaceSlug && isAdmin ? `WEBHOOKS_LIST_${workspaceSlug}` : null, workspaceSlug && isAdmin ? () => fetchWebhooks(workspaceSlug.toString()) : null ); if (!isAdmin) return (

You are not authorized to access this page.

); if (!webhooks) return (
); return (
{Object.keys(webhooks).length > 0 ? (
Webhooks
) : (
)}
); }); WebhooksListPage.getLayout = function getLayout(page: React.ReactElement) { return ( }> {page} ); }; export default WebhooksListPage;