diff --git a/src/App.js b/src/App.js index 42acea9..c29b96a 100644 --- a/src/App.js +++ b/src/App.js @@ -50,21 +50,38 @@ function ChangeFloor({ currentFloor, callbackFloorChanged }) { } function RoomResearch({ callbackRoomSelected }) { + const [currentRequest, setCurrentRequest] = React.useState(""); + const [rooms, setRooms] = React.useState([]); + + const startResearch = (event) => { + fetch("https://encartes.aliens-lyon.fr/api/map/find_place_by_name/" + currentRequest) + .then(response => response.json()) + .then(data => { + setRooms(data); + }); + }; + return <>
Rechercher une salle - + {setCurrentRequest(event.target.value)}} + variant="outlined" + fullWidth + /> - + - +
} diff --git a/src/Rooms.js b/src/Rooms.js index 39913d9..cf52073 100644 --- a/src/Rooms.js +++ b/src/Rooms.js @@ -5,24 +5,20 @@ import TableRow from '@mui/material/TableRow'; import TableCell from '@mui/material/TableCell'; import TableBody from '@mui/material/TableBody'; -export default function Rooms({callbackRoomSelected}) { +export default function Rooms({rooms, callbackRoomSelected}) { return Salle - Occupants - callbackRoomSelected('salle-M-GN1-3-av')}> - Amphi A - Maths - - callbackRoomSelected('salle-M-GN1-3-ae')}> - Amphi B - Infos - + {rooms.map((room) => { + return callbackRoomSelected(room['idRoom'])}> + {room['idRoom']} + + })}