add missing checks and default password

This commit is contained in:
Eduardo Quiros 2022-08-20 21:20:50 -06:00
parent 99e9ef98f6
commit 259444b371
No known key found for this signature in database
GPG Key ID: B77F36C3F12720B4
1 changed files with 5 additions and 3 deletions

View File

@ -100,16 +100,18 @@ const Inquilinos = () => {
})) }))
const saveTenant = () => { const saveTenant = () => {
if (tenant.email && tenant.number_house) { if (tenant.email && tenant.community_id && tenant.dni
&& tenant.name && tenant.last_name && tenant.phone) {
let _tenants = [...tenants] let _tenants = [...tenants]
let _tenant = { ...tenant } let _tenant = { ...tenant }
_tenant.community_id = communityId _tenant.community_id = communityId;
_tenant.password = _tenant.email;
console.log(_tenant) console.log(_tenant)
fetch(`http://localhost:4000/user/createUser`, { fetch(`http://localhost:4000/user/createUser`, {
cache: 'no-cache', cache: 'no-cache',
method: 'POST', method: 'POST',
body: JSON.stringify(tenant), body: JSON.stringify(_tenant),
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },