From 46f460aee36dcc59949da5b713668a72222dd88e Mon Sep 17 00:00:00 2001 From: SilviaAmAm Date: Thu, 23 Nov 2023 12:18:53 +0100 Subject: [PATCH] :alembic: Attempt hot-fix for hash based routing --- src/sdk.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/sdk.js b/src/sdk.js index 22deef75b..00c98a1f1 100644 --- a/src/sdk.js +++ b/src/sdk.js @@ -95,12 +95,17 @@ class OpenForm { CSPNonce.setValue(CSPNonceValue); initialiseSentry(sentryDSN, sentryEnv); - // ensure that the basename has no trailing slash (for react router) - let pathname = basePath || window.location.pathname; - if (pathname.endsWith('/')) { - pathname = pathname.slice(0, pathname.length - 1); + if (useHashRouting) { + this.basePath = ''; + } else { + // ensure that the basename has no trailing slash (for react router) + let pathname = basePath || window.location.pathname; + if (pathname.endsWith('/')) { + pathname = pathname.slice(0, pathname.length - 1); + } + this.basePath = pathname; } - this.basePath = pathname; + this.calculateClientBaseUrl(); }