evitar que se muestren los eliminados

This commit is contained in:
Mariela 2022-08-01 01:30:38 -06:00
parent 443b09e8e3
commit b213900733
1 changed files with 20 additions and 10 deletions

View File

@ -60,13 +60,17 @@ const AreasComunes = () => {
if (item.status == '1') { if (item.status == '1') {
item.status_text = 'Activo'; item.status_text = 'Activo';
} else if(item.status == '0') { } else if (item.status == '0') {
item.status_text = 'Inactivo'; item.status_text = 'Inactivo';
} else { } else {
item.status_text = 'Eliminado'; item.status_text = 'Eliminado';
} }
}) })
} }
data = data.filter(
(val) => val.status != -1,
)
setCommonAreaList(data); setCommonAreaList(data);
}); });
} }
@ -98,6 +102,9 @@ const AreasComunes = () => {
let _common_areas = commonAreaList.filter( let _common_areas = commonAreaList.filter(
(val) => val._id !== commonArea._id, (val) => val._id !== commonArea._id,
); );
_common_areas = _common_areas.filter(
(val) => val.status != -1,
)
setCommonAreaList(_common_areas); setCommonAreaList(_common_areas);
setDeleteCommonAreaDialog(false); setDeleteCommonAreaDialog(false);
setCommonArea(emptyCommonArea); setCommonArea(emptyCommonArea);
@ -121,15 +128,18 @@ const AreasComunes = () => {
let _commonareas = commonAreaList.filter( let _commonareas = commonAreaList.filter(
(val) => !selectedCommonAreas.includes(val), (val) => !selectedCommonAreas.includes(val),
); );
/* selectedCommunities.map((item) => { selectedCommonAreas.map((item) => {
fetch('http://localhost:4000/user/deleteCommunity/' + item._id, { fetch('http://localhost:4000/commonArea/deleteCommonArea/' + item._id, {
cache: 'no-cache', cache: 'no-cache',
method: 'DELETE', method: 'DELETE',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
}) })
})*/ });
_common_areas = _common_areas.filter(
(val) => val.status != -1,
)
setCommonAreaList(_commonareas); setCommonAreaList(_commonareas);
setDeleteCommonAreasDialog(false); setDeleteCommonAreasDialog(false);
setSelectedCommonAreas(null); setSelectedCommonAreas(null);