This commit is contained in:
Hugo Lextrait 2023-05-04 17:13:42 +02:00
parent 2bdc8a7e05
commit bdd65be688
2 changed files with 7 additions and 4 deletions

View File

@ -39,7 +39,7 @@ export type IPutFoldersParams = {
archived_description?: OfficeFolder["archived_description"];
status?: OfficeFolder["status"];
office_folder_has_stakeholder?: OfficeFolder["office_folder_has_stakeholder"];
OfficeFolderHasCustomer?: { customer: { uid: Customer["uid"] } }[];
office_folder_has_customers?: { customer: { uid: Customer["uid"] } }[];
};
@Service()

View File

@ -148,13 +148,16 @@ class AddClientToFolderClass extends BasePage<IPropsClass, IState> {
console.log("SELECTD >>>", this.props.selectedFolderUid);
const newCustomerCreated: Customer = await Customers.getInstance().post(customer);
console.log("NEW CUSTOMER CREATED >>>", newCustomerCreated);
if (newCustomerCreated) {
const query = {
OfficeFolderHasCustomer: [{ customer: { uid: newCustomerCreated.uid } }],
const body = {
office_folder_has_customers: [{ customer: { uid: newCustomerCreated.uid } }],
};
await Folders.getInstance().put(this.props.selectedFolderUid, query);
console.log("BODY >>>", body);
await Folders.getInstance().put(this.props.selectedFolderUid, body);
this.props.router.push(`/folders/${this.props.selectedFolderUid}`);
}
}