From b213900733bc11a5f3aa906ccf27fb1288635107 Mon Sep 17 00:00:00 2001 From: Mariela Date: Mon, 1 Aug 2022 01:30:38 -0600 Subject: [PATCH] evitar que se muestren los eliminados --- .../web-react/src/components/AreasComunes.js | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/web-ui/web-react/src/components/AreasComunes.js b/web-ui/web-react/src/components/AreasComunes.js index 09943617..ed5ef7d3 100644 --- a/web-ui/web-react/src/components/AreasComunes.js +++ b/web-ui/web-react/src/components/AreasComunes.js @@ -60,13 +60,17 @@ const AreasComunes = () => { if (item.status == '1') { item.status_text = 'Activo'; - } else if(item.status == '0') { + } else if (item.status == '0') { item.status_text = 'Inactivo'; } else { item.status_text = 'Eliminado'; } }) } + + data = data.filter( + (val) => val.status != -1, + ) setCommonAreaList(data); }); } @@ -98,6 +102,9 @@ const AreasComunes = () => { let _common_areas = commonAreaList.filter( (val) => val._id !== commonArea._id, ); + _common_areas = _common_areas.filter( + (val) => val.status != -1, + ) setCommonAreaList(_common_areas); setDeleteCommonAreaDialog(false); setCommonArea(emptyCommonArea); @@ -121,15 +128,18 @@ const AreasComunes = () => { let _commonareas = commonAreaList.filter( (val) => !selectedCommonAreas.includes(val), ); - /* selectedCommunities.map((item) => { - fetch('http://localhost:4000/user/deleteCommunity/' + item._id, { - cache: 'no-cache', - method: 'DELETE', - headers: { - 'Content-Type': 'application/json' - } - }) - })*/ + selectedCommonAreas.map((item) => { + fetch('http://localhost:4000/commonArea/deleteCommonArea/' + item._id, { + cache: 'no-cache', + method: 'DELETE', + headers: { + 'Content-Type': 'application/json' + } + }) + }); + _common_areas = _common_areas.filter( + (val) => val.status != -1, + ) setCommonAreaList(_commonareas); setDeleteCommonAreasDialog(false); setSelectedCommonAreas(null);