fix reservas
This commit is contained in:
parent
0b2ec5800a
commit
8b09f2812f
|
@ -20,13 +20,10 @@ export default function AreaComun({navigation}){
|
|||
const [service, setService] = useState("");
|
||||
const [areas, setAreas] = useState([])
|
||||
const [isRequesting, setIsRequesting] = useState(false);
|
||||
const [selectedHours, setSelectedHours] = useState(0);
|
||||
const [selectedMinutes, setSelectedMinutes] = useState(0);
|
||||
const [endSelectedHours, setEndSelectedHours] = useState(0);
|
||||
const [endSelectedMinutes, setEndSelectedMinutes] = useState(0);
|
||||
const [time, setTime] = useState(new Date())
|
||||
const [endTime, setEndTime] = useState(new Date())
|
||||
const idComunidad = user.community_id
|
||||
const date = new Date();
|
||||
const [mode, setMode] = useState('time');
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
|
@ -36,7 +33,7 @@ export default function AreaComun({navigation}){
|
|||
|
||||
|
||||
try {
|
||||
const jsonResponse = await fetch(`${API.BASE_URL}/commonArea/allCommonAreas`, {
|
||||
const jsonResponse = await fetch(`${API.BASE_URL}/commonArea/findByCommunity/` + `${idComunidad}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
|
@ -44,7 +41,7 @@ export default function AreaComun({navigation}){
|
|||
})
|
||||
|
||||
const response = await jsonResponse.json();
|
||||
console.log(response.message);
|
||||
// console.log(response.message);
|
||||
|
||||
setAreas(response.message);
|
||||
|
||||
|
@ -102,16 +99,10 @@ export default function AreaComun({navigation}){
|
|||
|
||||
|
||||
const onChangeStart = (event, selectedDate) => {
|
||||
const currentDate = selectedDate;
|
||||
setShow(false);
|
||||
const currentDate = selectedDate || time;
|
||||
|
||||
setTime(currentDate);
|
||||
};
|
||||
const onChangeEnd = (event, selectedDate) => {
|
||||
const currentDate = selectedDate;
|
||||
setShow(false);
|
||||
setEndTime(currentDate);
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<Center>
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
Box, Button,
|
||||
Center, FormControl, Heading, ScrollView, VStack
|
||||
} from "native-base";
|
||||
import { Dimensions, StyleSheet, TextInput, useWindowDimensions } from "react-native";
|
||||
import { StyleSheet, TextInput, useWindowDimensions } from "react-native";
|
||||
import { UserContext } from "../context/UserContext";
|
||||
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
|
||||
import { stringMd5 } from 'react-native-quick-md5';
|
||||
|
@ -14,7 +14,7 @@ const { Navigator, Screen } = createMaterialTopTabNavigator();
|
|||
|
||||
export default function Profile({ navigation }) {
|
||||
|
||||
const baseURL = `${API.BASE_URL}/user/updateGuarda/`
|
||||
const baseURL = `${API.BASE_URL}/user/updateUser/`
|
||||
const [index, setIndex] = useState(0);
|
||||
const layout = useWindowDimensions();
|
||||
const userData = useContext(UserContext)
|
||||
|
@ -22,6 +22,7 @@ export default function Profile({ navigation }) {
|
|||
const [apellido, setApellido] =useState(userData.user.last_name);
|
||||
const [email, setEmail] = useState(userData.user.email);
|
||||
const [password, setPassword] = useState();
|
||||
const [confirmPassword, setConfirmPassword] = useState()
|
||||
const id = userData.user._id;
|
||||
const decode = userData.Password;
|
||||
const [error, setError] = useState({})
|
||||
|
@ -132,7 +133,7 @@ export default function Profile({ navigation }) {
|
|||
|
||||
<FormControl>
|
||||
<FormControl.Label>Confirmar nueva contraseña</FormControl.Label>
|
||||
<TextInput editable={!error} style={styles.input} type="password" onChangeText={(value) => setPassword(value) }/>
|
||||
<TextInput editable={!error} style={styles.input} type="password" onChangeText={(value) => setConfirmPassword(value) }/>
|
||||
</FormControl>
|
||||
|
||||
<Button mt="2" backgroundColor="orange.300" onPress={() => updatePassword()} disabled={error}>
|
||||
|
@ -202,7 +203,6 @@ export default function Profile({ navigation }) {
|
|||
"name": name,
|
||||
"last_name": apellido,
|
||||
"email": email,
|
||||
"phone": userData.user.phone,
|
||||
"community_id": userData.user.community_id
|
||||
}
|
||||
|
||||
|
@ -221,10 +221,13 @@ export default function Profile({ navigation }) {
|
|||
})
|
||||
.then(response => {
|
||||
|
||||
console.log(response);
|
||||
|
||||
//console.log(baseURL+`${id}`);
|
||||
if (response.status != 201){
|
||||
// console.log('ocurrio un error ');
|
||||
console.log(response.json());
|
||||
console.log('ocurrio un error ');
|
||||
|
||||
|
||||
}else{
|
||||
return response.json();
|
||||
}
|
||||
|
|
|
@ -72,7 +72,9 @@ export class UsersController {
|
|||
|
||||
@MessagePattern({ cmd: 'updateUser' })
|
||||
update(@Payload() user: UserDocument) {
|
||||
return this.userService.update(user._id, user);
|
||||
console.log(user);
|
||||
|
||||
return this.userService.update(user['id'], user);
|
||||
}
|
||||
|
||||
@MessagePattern({ cmd: 'updateGuard' })
|
||||
|
|
|
@ -120,7 +120,10 @@ export class UsersService {
|
|||
console.log(id)
|
||||
console.log(user)
|
||||
|
||||
return this.userModel.findOneAndUpdate({ _id: id }, user, {
|
||||
return this.userModel.findOneAndUpdate({ _id: id }, {
|
||||
name: user['name'], last_name: user['last_name'],
|
||||
dni: user['dni'], email: user['email'], phone: user['phone']
|
||||
}, {
|
||||
new: true,
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue