Merge pull request #180 from DeimosPr4/179-issue-arreglar-fetch-de-casas
179 issue arreglar fetch de casas
This commit is contained in:
commit
ec2c56ae9c
|
@ -218,22 +218,22 @@ export class UsersService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async findNumHouseTenant(community_id: string, tenant_id: string) {
|
async findNumHouseTenant(community_id: string, tenant_id: string): Promise<string> {
|
||||||
const pattern = { cmd: 'findOneCommunity' }
|
const pattern = { cmd: 'findOneCommunity' }
|
||||||
const payload = { _id: community_id }
|
const payload = { _id: community_id }
|
||||||
|
|
||||||
let callback = await this.clientCommunityApp
|
let callback = this.clientCommunityApp
|
||||||
.send<string>(pattern, payload)
|
.send<string>(pattern, payload)
|
||||||
.pipe(
|
.pipe(map((response: string) => ({ response })))
|
||||||
map((response: string) => ({ response }))
|
|
||||||
)
|
|
||||||
const finalValue = await lastValueFrom(callback);
|
const finalValue = await lastValueFrom(callback);
|
||||||
const response = finalValue['response'];
|
const response = finalValue['response'];
|
||||||
const houses = response['houses'];
|
const houses = response['houses'];
|
||||||
let num_house = "";
|
let num_house = "";
|
||||||
await houses.forEach(async house => {
|
await houses.forEach(async (house: { [x: string]: string; }) => {
|
||||||
if (tenant_id == house.tenants.tenant_id) {
|
if (house['tenant_id'] !== undefined) {
|
||||||
num_house = house.number_house;
|
if (house['tenant_id'] === tenant_id) {
|
||||||
|
num_house = house['number_house'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return num_house;
|
return num_house;
|
||||||
|
|
|
@ -107,7 +107,6 @@ const Inquilinos = () => {
|
||||||
_tenant.community_id = cookies.community_id;
|
_tenant.community_id = cookies.community_id;
|
||||||
_tenant.number_house = houseNumber;
|
_tenant.number_house = houseNumber;
|
||||||
_tenant.password = _tenant.email;
|
_tenant.password = _tenant.email;
|
||||||
console.log(_tenant)
|
|
||||||
|
|
||||||
fetch(`http://localhost:4000/user/createUser`, {
|
fetch(`http://localhost:4000/user/createUser`, {
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
|
@ -433,7 +432,6 @@ const Inquilinos = () => {
|
||||||
const handleHouses = (e) => {
|
const handleHouses = (e) => {
|
||||||
const getHouseNumber = e.target.value;
|
const getHouseNumber = e.target.value;
|
||||||
setHouseNumber(getHouseNumber);
|
setHouseNumber(getHouseNumber);
|
||||||
console.log(getHouseNumber);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue