From 98ef5dab176664973a73b2a04625d5ac2f2870a4 Mon Sep 17 00:00:00 2001 From: Maria Sanchez Date: Tue, 23 Aug 2022 00:21:25 -0600 Subject: [PATCH] get hour picker on reservation --- mobile-ui/components/AreaComun.js | 43 ++++++++++++++++++++++++++++--- mobile-ui/components/Invitados.js | 2 +- 2 files changed, 40 insertions(+), 5 deletions(-) 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 - + -