diff --git a/mobile-ui/components/AreaComun.js b/mobile-ui/components/AreaComun.js index 6b2fd6d6..66855e49 100644 --- a/mobile-ui/components/AreaComun.js +++ b/mobile-ui/components/AreaComun.js @@ -29,6 +29,8 @@ export default function AreaComun({navigation}){ const onRequestReservasData = async () => { setIsRequesting(true); + + try { const jsonResponse = await fetch(`${API.BASE_URL}/commonArea/allCommonAreas`, { @@ -56,6 +58,39 @@ export default function AreaComun({navigation}){ }, [user]) + + + const postReserva = async() => { + + const data = { + + "start_time": selectedHours + ":" +selectedMinutes, + "finish_time": endSelectedHours + ":" +endSelectedMinutes, + "date_entry": "", + "user_id" : user._id, + "common_area_id": service + + } + + console.log(data); + // try { + + // const jsonDataResponse = await fetch(`${API.BASE_URL}/reservation/createReservation`, { + // cache: 'no-cache', + // method: 'POST', + // body: JSON.stringify(data), + // headers: { + // 'Content-Type': 'application/json' + // } + // }) + + // const response = await jsonResponse.json(); + // console.log(response.message); + + // } catch (error) { + // console.log("ERROR:" + error); + // } + } @@ -83,14 +118,14 @@ export default function AreaComun({navigation}){ }} mt={1} onValueChange={itemValue => setService(itemValue)}> {areas.map(item => ( - + ))} Hora de inicio - + Hora de finalizaciĆ³n - + -