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 payload = { _id: community_id }
|
||||
|
||||
let callback = await this.clientCommunityApp
|
||||
let callback = this.clientCommunityApp
|
||||
.send<string>(pattern, payload)
|
||||
.pipe(
|
||||
map((response: string) => ({ response }))
|
||||
)
|
||||
.pipe(map((response: string) => ({ response })))
|
||||
const finalValue = await lastValueFrom(callback);
|
||||
const response = finalValue['response'];
|
||||
const houses = response['houses'];
|
||||
let num_house = "";
|
||||
await houses.forEach(async house => {
|
||||
if (tenant_id == house.tenants.tenant_id) {
|
||||
num_house = house.number_house;
|
||||
await houses.forEach(async (house: { [x: string]: string; }) => {
|
||||
if (house['tenant_id'] !== undefined) {
|
||||
if (house['tenant_id'] === tenant_id) {
|
||||
num_house = house['number_house'];
|
||||
}
|
||||
}
|
||||
})
|
||||
return num_house;
|
||||
|
|
|
@ -107,7 +107,6 @@ const Inquilinos = () => {
|
|||
_tenant.community_id = cookies.community_id;
|
||||
_tenant.number_house = houseNumber;
|
||||
_tenant.password = _tenant.email;
|
||||
console.log(_tenant)
|
||||
|
||||
fetch(`http://localhost:4000/user/createUser`, {
|
||||
cache: 'no-cache',
|
||||
|
@ -433,7 +432,6 @@ const Inquilinos = () => {
|
|||
const handleHouses = (e) => {
|
||||
const getHouseNumber = e.target.value;
|
||||
setHouseNumber(getHouseNumber);
|
||||
console.log(getHouseNumber);
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
Loading…
Reference in New Issue