fix communities UI

This commit is contained in:
Eduardo Quiros 2022-09-01 16:02:50 -06:00
parent a44fe8caa2
commit b704597d54
No known key found for this signature in database
GPG Key ID: B77F36C3F12720B4
1 changed files with 29 additions and 27 deletions

View File

@ -257,6 +257,7 @@ const Communities = () => {
})
.catch((err) => console.log('Ocurrió un error con el fetch', err));
} else {
let _communities = [...communitiesList];
let _community = { ...community };
_community.province = provinciaId;
_community.canton = cantonId;
@ -275,36 +276,37 @@ const Communities = () => {
console.log('Ocurrió un error con el servicio: ' + response.status);
else return response.json();
})
.then(() => {
_community.province = provincesList.find(
(p) => p.code === _community.province,
).name;
_community.canton = cantonsList.find(
(p) => p.code === _community.canton,
).name;
_community.district = districtsList.find(
(p) => p.code === _community.district,
).name;
.then(() => {
_community.province = provincesList.find(
(p) => p.code === _community.province,
).name;
_community.canton = cantonsList.find(
(p) => p.code === _community.canton,
).name;
_community.district = districtsList.find(
(p) => p.code === _community.district,
).name;
_communities.push(_community);
toast.current.show({
severity: 'success',
summary: 'Registro exitoso',
detail: 'Comunidad de vivienda Creada',
life: 3000,
});
_communities.push(_community);
toast.current.show({
severity: 'success',
summary: 'Registro exitoso',
detail: 'Comunidad de vivienda Creada',
life: 3000,
});
setCommunitiesList(_communities);
setCommunitiesList(_communities);
setProvinciaId('');
setCantonId('');
setDistrictId('');
setCodeHouses('');
setFormCommunityDialog(false);
setProvinciaId('');
setCantonId('');
setDistrictId('');
setCodeHouses('');
setFormCommunityDialog(false);
setCommunity(emptyCommunity);
})
.catch((err) => console.log('Ocurrió un error con el fetch', err));
setCommunity(emptyCommunity);
})
.catch((err) => console.log('Ocurrió un error con el fetch', err));
}
} else {
setSubmitted(true);
}