Skip to content

Commit

Permalink
fix: Handle url join with and without route_prefix and with and wit…
Browse files Browse the repository at this point in the history
…hout trailing slash
  • Loading branch information
kinkard committed Jan 21, 2025
1 parent 5975bfe commit 595c9da
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 595c9da

Please sign in to comment.