From ad4d194759641d80d60f3f57e2df359d2fdc9946 Mon Sep 17 00:00:00 2001 From: Mariela Date: Mon, 22 Aug 2022 18:23:05 -0600 Subject: [PATCH] eliminar inquilinos varios --- web-ui/web-react/src/components/Inquilinos.js | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/web-ui/web-react/src/components/Inquilinos.js b/web-ui/web-react/src/components/Inquilinos.js index 459cee47..82908833 100644 --- a/web-ui/web-react/src/components/Inquilinos.js +++ b/web-ui/web-react/src/components/Inquilinos.js @@ -148,7 +148,7 @@ const Inquilinos = () => { detail: 'Inquilino creado', life: 3000, }) - + setTenants(_tenants) setTenant(emptyTenant) setHouseNumber('') @@ -231,7 +231,24 @@ const Inquilinos = () => { } const deleteSelectedTenants = () => { - let _tenants = tenants.filter((val) => !selectedTentants.includes(val)) + let _tenants = tenants.filter( + (val) => !selectedTentants.includes(val) + ); + selectedTentants.map((item) => { + let _tenant = { + community_id: item.community_id, + number_house: item.number_house + }; + fetch('http://localhost:4000/user/deleteTenant/' + item._id, { + cache: 'no-cache', + method: 'PUT', + body: JSON.stringify(_tenant), + headers: { + 'Content-Type': 'application/json', + }, + }); + }); + setTenants(_tenants) setDeleteTenantsDialog(false) setSelectedTenants(null)