From 58104ea85da75b25d4d80b68cd1602beb2e20034 Mon Sep 17 00:00:00 2001 From: CyferShepard Date: Fri, 6 Sep 2024 19:31:27 +0200 Subject: [PATCH] base url possible fix + logging for baseurl variables --- src/index.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/index.jsx b/src/index.jsx index 1cba612..8642ad2 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -16,8 +16,13 @@ import Loading from "./pages/components/general/loading.jsx"; import routes from "./routes.jsx"; const baseUrl = import.meta.env.JS_BASE_URL ?? "/"; -const validBaseUrls = [...new Set([baseUrl, ...routes.map((route) => "/" + route.path.split("/")[1])])]; +let validBaseUrls = [...new Set([baseUrl, ...routes.map((route) => "/" + route.path.split("/")[1])])]; +if (baseUrl != "/") { + validBaseUrls = validBaseUrls.filter((url) => url != "/"); +} const locationBase = "/" + window.location.pathname.split("/")[1]; +console.log("Base URL: ", baseUrl); +console.log("Valid Base URLs: ", validBaseUrls); if (!validBaseUrls.includes(locationBase)) { window.location.assign(baseUrl);