diff options
Diffstat (limited to 'packages/demobank-ui')
-rw-r--r-- | packages/demobank-ui/src/settings.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/demobank-ui/src/settings.ts b/packages/demobank-ui/src/settings.ts index 67f926e7f..b7d285519 100644 --- a/packages/demobank-ui/src/settings.ts +++ b/packages/demobank-ui/src/settings.ts @@ -46,7 +46,7 @@ export interface BankUiSettings { * Global settings for the bank UI. */ const defaultSettings: BankUiSettings = { - backendBaseURL: undefined, + backendBaseURL: buildDefaultBackendBaseURL(), iconLinkURL: undefined, bankName: "Taler Bank", simplePasswordForRandomAccounts: false, @@ -79,3 +79,11 @@ export function fetchSettings(listener: (s: BankUiSettings) => void): void { } + +function buildDefaultBackendBaseURL(): string | undefined { + if (typeof window !== "undefined") { + const currentLocation = new URL(window.location.pathname, window.location.origin).href + return currentLocation.replace("/webui", "") + } + return undefined +} |