mirror of
https://github.com/Awesome-Technologies/synapse-admin.git
synced 2025-07-23 14:04:42 +02:00
fix: Start if BASE_URL
is not defined (#677)
This commit is contained in:
parent
7a286ad506
commit
ef8ae9b38f
@ -5,7 +5,13 @@ import { createRoot } from "react-dom/client";
|
|||||||
import App from "./App";
|
import App from "./App";
|
||||||
import { AppContext } from "./AppContext";
|
import { AppContext } from "./AppContext";
|
||||||
|
|
||||||
fetch(`${import.meta.env.BASE_URL}/config.json`)
|
const baseUrl = import.meta.env.BASE_URL;
|
||||||
|
const configJSON = "config.json";
|
||||||
|
// if import.meta.env.BASE_URL have a trailing slash, remove it
|
||||||
|
// load config.json from relative path if import.meta.env.BASE_URL is None or empty
|
||||||
|
const configJSONUrl = baseUrl ? `${baseUrl.replace(/\/$/, "")}/${configJSON}` : configJSON;
|
||||||
|
|
||||||
|
fetch(configJSONUrl)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(props =>
|
.then(props =>
|
||||||
createRoot(document.getElementById("root")).render(
|
createRoot(document.getElementById("root")).render(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user