Merge pull request #180 from DeimosPr4/179-issue-arreglar-fetch-de-casas

179 issue arreglar fetch de casas
This commit is contained in:
Eduardo Quiros 2022-08-21 14:16:54 +00:00 committed by GitHub
commit ec2c56ae9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 11 deletions

View File

@ -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;

View File

@ -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 (