taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit fbcaff9f7663ce6e4d7c586003138a88b36ecdeb
parent 9ebe77e228debacdda9e351b6b49ede85c8a03b7
Author: Sebastian <sebasjm@gmail.com>
Date:   Mon, 27 Nov 2023 14:29:51 -0300

default backend is location without webui

Diffstat:
Mpackages/demobank-ui/src/settings.ts | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git 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 +}