diff --git a/backend/main.py b/backend/main.py index 8ed0e9b..ff1acd5 100755 --- a/backend/main.py +++ b/backend/main.py @@ -175,15 +175,14 @@ async def get_stop( ) ) - # print(f"{stops = }", flush=True) formatted.extend(_format_stop(stop) for stop in stops.values()) return formatted # TODO: Cache response for 30 secs ? -@app.get("/stop/nextPassages/{stop_id}") -async def get_next_passages(stop_id: str) -> NextPassagesSchema | None: +@app.get("/stop/{stop_id}/nextPassages") +async def get_next_passages(stop_id: int) -> NextPassagesSchema | None: res = await idfm_interface.get_next_passages(stop_id) if res is None: return None @@ -250,8 +249,7 @@ async def get_stop_destinations( return destinations -# TODO: Rename endpoint -> /stop/{stop_id}/shape -@app.get("/stop_shape/{stop_id}") +@app.get("/stop/{stop_id}/shape") async def get_stop_shape(stop_id: int) -> StopShapeSchema | None: connection_area = None diff --git a/frontend/src/businessData.tsx b/frontend/src/businessData.tsx index 93e4a3b..81d7e4c 100644 --- a/frontend/src/businessData.tsx +++ b/frontend/src/businessData.tsx @@ -93,7 +93,7 @@ export function BusinessDataProvider(props: { children: JSX.Element }) { const refreshPassages = async (stopId: number): Promise => { const httpOptions = { headers: { "Content-Type": "application/json" } }; console.log(`Fetching data for ${stopId}`); - const data = await fetch(`${serverUrl()}/stop/nextPassages/${stopId}`, httpOptions); + const data = await fetch(`${serverUrl()}/stop/${stopId}/nextPassages`, httpOptions); const response = await data.json(); _cleanupPassages(response.passages); addPassages(response.passages); @@ -183,7 +183,7 @@ ${linePassagesDestination.length} here... refresh all them.`); let shape = store.stopShapes[stopId]; if (shape === undefined) { console.log(`No shape found for ${stopId} stop... fetch it from backend.`); - const data = await fetch(`${serverUrl()}/stop_shape/${stopId}`, { + const data = await fetch(`${serverUrl()}/stop/${stopId}/shape`, { headers: { 'Content-Type': 'application/json' } }); shape = await data.json();