From b3a44dd97c6ff821aa18745abd7da5ec69d3087f Mon Sep 17 00:00:00 2001 From: Hugo Lextrait Date: Fri, 5 May 2023 15:00:33 +0200 Subject: [PATCH] hot fix --- .../Folder/AddClientToFolder/index.tsx | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/front/Components/Layouts/Folder/AddClientToFolder/index.tsx b/src/front/Components/Layouts/Folder/AddClientToFolder/index.tsx index 44f7e245..5daf7a2d 100644 --- a/src/front/Components/Layouts/Folder/AddClientToFolder/index.tsx +++ b/src/front/Components/Layouts/Folder/AddClientToFolder/index.tsx @@ -188,21 +188,18 @@ class AddClientToFolderClass extends BasePage { ) { values["civility"] = ECivility.MALE; // TODO: should maybe be deleted later or added to the form - let customersToLink: IPutFoldersParams["office_folder_has_customers"] = []; + let customersToLink: IPutFoldersParams["office_folder_has_customers"] = this.state.selectedCustomers.map((customer) => { + return { + customer: { uid: customer.value }, + }; + }) as IPutFoldersParams["office_folder_has_customers"]; + if (this.state.isNewClientSelected) { const customer: Customer = await Customers.getInstance().post({ - customer: values, + contact: values, }); if (!customer.uid) return; - customersToLink = [{ customer: { uid: customer.uid } }]; - } - - if (this.state.isExistingClientSelected) { - customersToLink = this.state.selectedCustomers.map((customer) => { - return { - customer: { uid: customer.value }, - }; - }) as IPutFoldersParams["office_folder_has_customers"]; + customersToLink?.push({ customer: { uid: customer.uid } }); } if (customersToLink) {