arreglar ultimos detalles para el eliminar

This commit is contained in:
Mariela 2022-08-22 16:43:52 -06:00
parent a9c02244a8
commit 2dcfdf495f
2 changed files with 31 additions and 30 deletions

View File

@ -195,7 +195,7 @@ export class UsersService {
} }
async deleteAdminSystem(id: string) { async deleteAdminSystem(id: string) {
return this.userModel.findOneAndUpdate({ _id: id }, { status: '-1', number_house:'' }, { return this.userModel.findOneAndUpdate({ _id: id }, { status: '-1'}, {
new: true, new: true,
}); });
} }
@ -209,7 +209,7 @@ export class UsersService {
async deleteTenant(tenant_id: string, community_id: string, number_house: string) { async deleteTenant(tenant_id: string, community_id: string, number_house: string) {
try{ try{
this.userModel.findOneAndUpdate({ _id: tenant_id }, { status: '-1' }, { await this.userModel.findOneAndUpdate({ _id: tenant_id }, { status: '-1', number_house:''}, {
new: true, new: true,
}); });

View File

@ -60,7 +60,7 @@ const Inquilinos = () => {
.then((response) => response.json()) .then((response) => response.json())
.then((data) => data.message) .then((data) => data.message)
.then((data) => { .then((data) => {
data = data.filter((val) => val.status !== -1) data = data.filter((val) => val.status != -1)
data.map((item) => { data.map((item) => {
if (item.status === '1') { if (item.status === '1') {
item.status_text = 'Activo' item.status_text = 'Activo'
@ -135,7 +135,7 @@ const Inquilinos = () => {
console.log(`Hubo un error en el servicio: ${response.status}`) console.log(`Hubo un error en el servicio: ${response.status}`)
else return response.json() else return response.json()
}) })
.then(() => { .then((data) => {
if (_tenant.status === '1') { if (_tenant.status === '1') {
_tenant.status_text = 'Activo' _tenant.status_text = 'Activo'
} else if (_tenant.status === '0') { } else if (_tenant.status === '0') {
@ -217,7 +217,8 @@ const Inquilinos = () => {
severity: 'success', severity: 'success',
summary: 'Inquilino Eliminado', summary: 'Inquilino Eliminado',
life: 3000, life: 3000,
}) } })
}
) )
.catch( .catch(
err => { err => {