diff options
author | Sebastian <sebasjm@gmail.com> | 2023-11-16 13:28:57 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-11-16 13:28:57 -0300 |
commit | c4ff77168e233235dcdea24108701dbc9f57fd87 (patch) | |
tree | 4c1d5858f7d76c3276a279ba18f7121b06e11c65 | |
parent | 3acb70a539d9ea99971c83d31b57aa1ca65049b8 (diff) |
take domain from baseurl instead of browser
-rw-r--r-- | packages/aml-backoffice-ui/src/hooks/useBackend.ts | 4 | ||||
-rw-r--r-- | packages/aml-backoffice-ui/src/pages/Officer.tsx | 11 |
2 files changed, 6 insertions, 9 deletions
diff --git a/packages/aml-backoffice-ui/src/hooks/useBackend.ts b/packages/aml-backoffice-ui/src/hooks/useBackend.ts index 95277a915..0615c9c99 100644 --- a/packages/aml-backoffice-ui/src/hooks/useBackend.ts +++ b/packages/aml-backoffice-ui/src/hooks/useBackend.ts @@ -74,8 +74,8 @@ export function getInitialBackendBaseURL(): string { if (!uiSettings.backendBaseURL) { console.error( "ERROR: backendBaseURL was overridden by a setting file and missing. Setting value to 'window.origin'", - ); - result = window.origin + ); + result = typeof (window as any) !== "undefined" ? window.origin : "localhost" } else { result = uiSettings.backendBaseURL; } diff --git a/packages/aml-backoffice-ui/src/pages/Officer.tsx b/packages/aml-backoffice-ui/src/pages/Officer.tsx index 21c26f3d4..ec8327814 100644 --- a/packages/aml-backoffice-ui/src/pages/Officer.tsx +++ b/packages/aml-backoffice-ui/src/pages/Officer.tsx @@ -3,9 +3,7 @@ import { useOfficer } from "../hooks/useOfficer.js"; import { HandleAccountNotReady } from "./HandleAccountNotReady.js"; import { useTranslationContext } from "@gnu-taler/web-util/browser"; import { uiSettings } from "../settings.js"; - -const DOMAIN = - typeof (window as any) !== "undefined" ? window.origin : "exchange.taler.net" +import { getInitialBackendBaseURL } from "../hooks/useBackend.js"; export function Officer() { const officer = useOfficer(); @@ -14,7 +12,8 @@ export function Officer() { return <HandleAccountNotReady officer={officer} />; } - const signupEmail = uiSettings.signupEmail ?? `aml-signup@${DOMAIN}` + const url = new URL(getInitialBackendBaseURL()) + const signupEmail = uiSettings.signupEmail ?? `aml-signup@${url.hostname}` return ( <div> @@ -26,9 +25,7 @@ export function Officer() { </div> <p> <a - href={`mailto:${signupEmail}?body=${encodeURIComponent( - `I want my AML account\n\n\nPubKey: ${officer.account.id}`, - )}`} + href={`mailto:${signupEmail}?subject=${encodeURIComponent("Request AML signup")}&body=${encodeURIComponent(`I want my AML account\n\n\nPubKey: ${officer.account.id}`)}`} target="_blank" rel="noreferrer" class="m-4 block rounded-md w-fit border-0 px-3 py-2 text-center text-sm bg-indigo-700 text-white shadow-sm hover:bg-indigo-700" |