import Head from "next/head"; import { faPlus } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { createNotification } from "@app/components/notifications"; import { Button, DeleteActionModal } from "@app/components/v2"; import { usePopUp } from "@app/hooks"; import { useDeleteSharedSecret } from "@app/hooks/api/secretSharing"; import { AddShareSecretModal } from "./AddShareSecretModal"; import { ShareSecretsTable } from "./ShareSecretsTable"; type DeleteModalData = { name: string; id: string }; export const ShareSecretSection = () => { const deleteSharedSecret = useDeleteSharedSecret(); const { popUp, handlePopUpToggle, handlePopUpClose, handlePopUpOpen } = usePopUp([ "createSharedSecret", "deleteSharedSecretConfirmation" ] as const); const onDeleteApproved = async () => { try { deleteSharedSecret.mutateAsync({ sharedSecretId: (popUp?.deleteSharedSecretConfirmation?.data as DeleteModalData)?.id, }); createNotification({ text: "Successfully deleted shared secret", type: "success" }); handlePopUpClose("deleteSharedSecretConfirmation"); } catch (err) { console.error(err); createNotification({ text: "Failed to delete shared secret", type: "error" }); } }; return (
Shared Secrets
} onClick={() => { handlePopUpOpen("createSharedSecret"); }} > Share Secret