valdiacion reservas

This commit is contained in:
Maria Sanchez 2022-08-30 22:50:25 -06:00
parent b117491db9
commit 8d020cf055
2 changed files with 15 additions and 9 deletions

View File

@ -144,7 +144,7 @@ export default function AreaComun({navigation}){
<FormControl isRequired> <FormControl isRequired>
<FormControl.Label>Hora de inicio</FormControl.Label> <FormControl.Label>Hora de inicio</FormControl.Label>
<View > <View >
<DateTimePicker mode="datetime" is24Hour value={time} onChangeStart={onChangeStart}/> <DateTimePicker minimumDate={date} mode="datetime" is24Hour value={time} onChangeStart={onChangeStart}/>
</View> </View>
</FormControl> </FormControl>

View File

@ -15,13 +15,13 @@ const { Navigator, Screen } = createMaterialTopTabNavigator();
export default function Profile({ navigation }) { export default function Profile({ navigation }) {
const baseURL = `${API.BASE_URL}/user/updateUser/` 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 [index, setIndex] = useState(0);
const layout = useWindowDimensions(); const layout = useWindowDimensions();
const userData = useContext(UserContext) 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 id = userData.user._id;
const decode = userData.Password; const decode = userData.Password;
const [error, setError] = useState({}) const [error, setError] = useState({})
@ -37,6 +37,7 @@ export default function Profile({ navigation }) {
console.log(userData.user.password); console.log(userData.user.password);
if (userData.user.password == dpassword) { if (userData.user.password == dpassword) {
console.log(true); console.log(true);
setError({});
}else{ }else{
console.log(false); console.log(false);
setError({ ...error, setError({ ...error,
@ -79,7 +80,7 @@ export default function Profile({ navigation }) {
</FormControl> </FormControl>
<FormControl> <FormControl>
<FormControl.Label>Apellido</FormControl.Label> <FormControl.Label>Apellido</FormControl.Label>
<TextInput style={styles.input} type="text"defaultValue={userData.user.last_name} onChangeText={(value) => setApellido(value) } /> <TextInput style={styles.input} type="text" defaultValue={userData.user.last_name} onChangeText={(value) => setApellido(value) } />
</FormControl> </FormControl>
<FormControl> <FormControl>
<FormControl.Label>Correo electrónico</FormControl.Label> <FormControl.Label>Correo electrónico</FormControl.Label>
@ -179,9 +180,10 @@ export default function Profile({ navigation }) {
}) })
.then(response => { .then(response => {
console.log(baseURL+`${id}`); // console.log(baseURL+`${id}`);
if (response.status != 201){ if (response.status != 201){
console.log('ocurrio un error '); console.log('ocurrio un error ');
}else{ }else{
return response.json(); return response.json();
} }
@ -206,8 +208,11 @@ export default function Profile({ navigation }) {
"status": userData.user.status, "status": userData.user.status,
"date_entry": userData.user.date_entry, "date_entry": userData.user.date_entry,
"community_id": userData.user.community_id, "community_id": userData.user.community_id,
"number_house": '20'
} }
console.log(data);
try { try {
await fetch(baseURL+`${id}`, { await fetch(baseURL+`${id}`, {
@ -221,9 +226,10 @@ export default function Profile({ navigation }) {
}) })
.then(response => { .then(response => {
console.log(baseURL+`${id}`); //console.log(baseURL+`${id}`);
if (response.status != 201){ if (response.status != 201){
console.log('ocurrio un error '); // console.log('ocurrio un error ');
console.log(response.json());
}else{ }else{
return response.json(); return response.json();
} }