Skip to content

Commit

Permalink
Removing trailing slashes where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
gauglertodd committed Aug 1, 2024
1 parent eb04f60 commit 5d80fa9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions js/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,25 @@ import "@finos/perspective-viewer/dist/css/themes.css";
import "@finos/perspective-workspace";
import "./index.css";

function removeTrailingSlash(url) {
return url.replace(/\/$/, "");
}

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}${window.location.pathname}/ws`,
`${protocol}//${window.location.host}${removeTrailingSlash(
window.location.pathname,
)}/ws`,
);
const registeredTables = new Set();
const worker = perspective.worker();

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

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

0 comments on commit 5d80fa9

Please sign in to comment.