Skip to content

Commit

Permalink
use relative paths for JS code
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Paine <[email protected]>
  • Loading branch information
timkpaine committed Jun 12, 2024
1 parent 2467efa commit 8232466
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ window.addEventListener("load", async () => {
const workspace = document.querySelector("perspective-workspace");
const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
const websocket = perspective.websocket(
`${protocol}//${window.location.host}/ws`,
`${protocol}//${window.location.host}${window.location.pathname}/ws`,
);
const registeredTables = new Set();
const worker = perspective.worker();

const updateTables = async () => {
const response = await fetch("/tables");
const response = await fetch(`${window.location.href}/tables`);
const tables = await response.json();

tables.map(async (tableName) => {
Expand Down

1 comment on commit 8232466

@gauglertodd
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if window.location.href is 'http://127.0.0.1:8000/', or if window.location.pathname is just "/"? It'l'l look for 'http://127.0.0.1:8000//tables or //ws won't it?
i

Please sign in to comment.