From 8d020cf055fd61903c01d90bff105b7e166744a0 Mon Sep 17 00:00:00 2001 From: Maria Sanchez Date: Tue, 30 Aug 2022 22:50:25 -0600 Subject: [PATCH] valdiacion reservas --- mobile-ui/components/AreaComun.js | 2 +- mobile-ui/components/Profile.js | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/mobile-ui/components/AreaComun.js b/mobile-ui/components/AreaComun.js index 74c89b88..3f1e4ac9 100644 --- a/mobile-ui/components/AreaComun.js +++ b/mobile-ui/components/AreaComun.js @@ -144,7 +144,7 @@ export default function AreaComun({navigation}){ Hora de inicio - + diff --git a/mobile-ui/components/Profile.js b/mobile-ui/components/Profile.js index dfe7e718..6282967b 100644 --- a/mobile-ui/components/Profile.js +++ b/mobile-ui/components/Profile.js @@ -15,13 +15,13 @@ const { Navigator, Screen } = createMaterialTopTabNavigator(); export default function Profile({ navigation }) { const baseURL = `${API.BASE_URL}/user/updateUser/` - const [name, setName] = useState(); - const [apellido, setApellido] =useState(); - const [email, setEmail] = useState(); - const [password, setPassword] = useState(); const [index, setIndex] = useState(0); const layout = useWindowDimensions(); const userData = useContext(UserContext) + const [name, setName] = useState(userData.user.name); + const [apellido, setApellido] =useState(userData.user.last_name); + const [email, setEmail] = useState(userData.user.email); + const [password, setPassword] = useState(); const id = userData.user._id; const decode = userData.Password; const [error, setError] = useState({}) @@ -37,6 +37,7 @@ export default function Profile({ navigation }) { console.log(userData.user.password); if (userData.user.password == dpassword) { console.log(true); + setError({}); }else{ console.log(false); setError({ ...error, @@ -79,7 +80,7 @@ export default function Profile({ navigation }) { Apellido - setApellido(value) } /> + setApellido(value) } /> Correo electrónico @@ -179,9 +180,10 @@ export default function Profile({ navigation }) { }) .then(response => { - console.log(baseURL+`${id}`); + // console.log(baseURL+`${id}`); if (response.status != 201){ console.log('ocurrio un error '); + }else{ return response.json(); } @@ -206,8 +208,11 @@ export default function Profile({ navigation }) { "status": userData.user.status, "date_entry": userData.user.date_entry, "community_id": userData.user.community_id, + "number_house": '20' } + console.log(data); + try { await fetch(baseURL+`${id}`, { @@ -221,9 +226,10 @@ export default function Profile({ navigation }) { }) .then(response => { - console.log(baseURL+`${id}`); + //console.log(baseURL+`${id}`); if (response.status != 201){ - console.log('ocurrio un error '); + // console.log('ocurrio un error '); + console.log(response.json()); }else{ return response.json(); }