Fixing delete client popup
This commit is contained in:
parent
8ec3030063
commit
0a89712489
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user