import { useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import { Button, ButtonProps, Dialog, DialogContent, DialogTrigger, Icon, showToast, DialogFooter, DialogClose, } from "../../.."; export default function DisconnectIntegration({ credentialId, label, trashIcon, isGlobal, onSuccess, buttonProps, }: { credentialId: number; label?: string; trashIcon?: boolean; isGlobal?: boolean; onSuccess?: () => void; buttonProps?: ButtonProps; }) { const { t } = useLocale(); const [modalOpen, setModalOpen] = useState(false); const mutation = trpc.viewer.deleteCredential.useMutation({ onSuccess: () => { showToast(t("app_removed_successfully"), "success"); setModalOpen(false); onSuccess && onSuccess(); }, onError: () => { showToast(t("error_removing_app"), "error"); setModalOpen(false); }, }); return ( <> setModalOpen(false)} /> mutation.mutate({ id: credentialId })}> {t("yes_remove_app")} ); }