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') {
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);