Skip to content

Commit

Permalink
⚗️ Attempt hot-fix for hash based routing
Browse files Browse the repository at this point in the history
  • Loading branch information
SilviaAmAm committed Nov 23, 2023
1 parent 9b50efa commit 46f460a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 46f460a

Please sign in to comment.