diff --git a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/ClientBox/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/ClientBox/index.tsx index a99ad14d..45394578 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/ClientBox/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/ClientBox/index.tsx @@ -12,6 +12,7 @@ import { useCallback } from "react"; import { AnchorStatus } from "../.."; import classes from "./classes.module.scss"; import DeleteCustomerModal from "./DeleteCustomerModal"; +import Documents from "@Front/Api/LeCoffreApi/Notary/Documents/Documents"; type IProps = { customer: Customer; @@ -28,8 +29,12 @@ export default function ClientBox(props: IProps) { const { isOpen: isErrorModalOpen, open: openErrorModal, close: closeErrorModal } = useOpenable(); const handleDelete = useCallback( - (customerUid: string) => { - if (customer.documents && customer.documents.length > 0) { + async (customerUid: string) => { + console.log(customer); + const documents = await Documents.getInstance().get({ where: { depositor_uid: customerUid, folder_uid: folderUid } }); + console.log(documents); + + if (documents && documents.length > 0) { closeDeleteModal(); openErrorModal(); return;