diff --git a/src/config.ts b/src/config.ts new file mode 100644 index 0000000000000000000000000000000000000000..79a3ff32c7134f2e341c47a0564ba7a29d795cb0 --- /dev/null +++ b/src/config.ts @@ -0,0 +1 @@ +export const BASE_URL = "/infoscreen"; // No trailing slash diff --git a/src/services/LayoutService.ts b/src/services/LayoutService.ts index 2b90cad305f707c48d656b7f6a33e6a20948ee2f..070cfcc77a27d56e4b750c8ed8c0cf0f52fb516c 100644 --- a/src/services/LayoutService.ts +++ b/src/services/LayoutService.ts @@ -1,4 +1,5 @@ import {LayoutConfig} from "../types/LayoutConfig"; +import {BASE_URL} from "../config"; const NO_LAYOUT_CONFIG: LayoutConfig = { id: "", @@ -13,9 +14,9 @@ export class LayoutService { static async init(): Promise<void> { try { - const activeConfigs = await fetch("/activeConfigs.json").then(content => content.json()); + const activeConfigs = await fetch(BASE_URL + "/activeConfigs.json").then(content => content.json()); const configFetches = (activeConfigs as string[]) - .map(configPath => fetch(configPath).then(content => content.json())); + .map(configPath => fetch(BASE_URL + "/" + configPath).then(content => content.json())); LayoutService.configs = await Promise.all(configFetches); } catch (e) {