import { t } from "@lingui/core/macro"; import Button from "~/components/Button"; import { useModal } from "~/providers/modal"; import { usePopup } from "~/providers/popup"; import { api } from "~/utils/api"; export function DeleteLabelConfirmation({ labelPublicId, refetch, }: { labelPublicId: string; refetch: () => void; }) { const { closeModal, closeModals } = useModal(); const { showPopup } = usePopup(); const deleteLabelMutation = api.label.delete.useMutation({ onSuccess: () => { refetch(); closeModals(2); }, onError: () => showPopup({ header: t`Error deleting label`, message: t`Please try again later, or contact customer support.`, icon: "error", }), }); const handleDeleteLabel = () => { deleteLabelMutation.mutate({ labelPublicId, }); }; return (
{t`This action can't be undone.`}