import Button from "~/components/Button"; import { useBoard } from "~/providers/board"; import { useModal } from "~/providers/modal"; import { usePopup } from "~/providers/popup"; import { api } from "~/utils/api"; interface DeleteListConfirmationProps { listPublicId: string; } export function DeleteListConfirmation({ listPublicId, }: DeleteListConfirmationProps) { const utils = api.useUtils(); const { boardData } = useBoard(); const { closeModal } = useModal(); const { showPopup } = usePopup(); const refetchBoard = async () => { if (boardData?.publicId) { try { await utils.board.byId.refetch(); } catch (e) { console.error(e); } } }; const deleteList = api.list.delete.useMutation({ onSuccess: () => { closeModal(); return refetchBoard(); }, onError: async () => { closeModal(); await refetchBoard(); showPopup({ header: "Unable to delete list", message: "Please try again later, or contact customer support.", icon: "error", }); }, }); return (

Are you sure you want to delete this list?

{"This action can't be undone."}

); }