Display trip details
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
export function fetchApi(pathcomponents, query) {
|
||||
console.log(pathcomponents);
|
||||
query.pretty = true;
|
||||
let url = '/api/' + pathcomponents.join("/") + "?" + new URLSearchParams(query).toString();
|
||||
let url = '/api/' + pathcomponents.map(component => encodeURIComponent(component)).join("/") + "?" + new URLSearchParams(query).toString();
|
||||
console.log(url);
|
||||
return fetch(url).then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error("Fetching api failed");
|
||||
@@ -26,3 +28,7 @@ export function fetchJourneys(from_, to) {
|
||||
to: to,
|
||||
});
|
||||
}
|
||||
|
||||
export function fetchTrip(trip_id) {
|
||||
return fetchApi(["trips", trip_id], {});
|
||||
}
|
||||
|
Reference in New Issue
Block a user