import { t } from "@lingui/core/macro"; import { Trans } from "@lingui/react/macro"; import Button from "~/components/Button"; import { useModal } from "~/providers/modal"; import { usePopup } from "~/providers/popup"; import { useWorkspace } from "~/providers/workspace"; import { api } from "~/utils/api"; export function DeleteMemberConfirmation() { const utils = api.useUtils(); const { closeModal, entityLabel, entityId } = useModal(); const { workspace } = useWorkspace(); const { showPopup } = usePopup(); const deleteMember = api.member.delete.useMutation({ onSuccess: async () => { closeModal(); try { await utils.workspace.byId.refetch(); } catch (e) { console.error(e); } }, onError: () => { showPopup({ header: t`Unable to remove member`, message: t`Please try again later, or contact customer support.`, icon: "error", }); closeModal(); }, }); const handleDeleteMember = () => { if (entityId) deleteMember.mutate({ memberPublicId: entityId, workspacePublicId: workspace.publicId, }); }; return (
{t`They won't be able to access this workspace.`}