From 595c9da98e74eee39346779edcdf7464b296a993 Mon Sep 17 00:00:00 2001 From: kinkard Date: Tue, 21 Jan 2025 11:50:02 +0100 Subject: [PATCH] fix: Handle url join with and without `route_prefix` and with and without trailing slash --- web/index.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/index.html b/web/index.html index 299b069..fa5a4f9 100644 --- a/web/index.html +++ b/web/index.html @@ -371,7 +371,8 @@ const bounds = map.getBounds(); const bbox = `${bounds.getSouth()},${bounds.getWest()};${bounds.getNorth()},${bounds.getEast()}`; // todo: probably we want to limit road graph level based on a zoom level - fetch(`${window.location.href}/api/traffic/${bbox}`, { + const url = new URL(`/api/traffic/${bbox}`, window.location.href); + fetch(url.toString(), { method: "GET", headers: { "Content-Type": "application/json", @@ -438,7 +439,8 @@ return; } - return fetch(`${window.location.href}/api/request`, { + const url = new URL('/api/request', window.location.href); + return fetch(url.toString(), { method: "POST", headers: { "Content-Type": "application/json",