show warning if bank settings are wrong

This commit is contained in:
Sebastian 2023-04-13 12:17:50 -03:00
parent b567ba4668
commit 2baa42f223
No known key found for this signature in database
GPG Key ID: 173909D1A5F66069
3 changed files with 17 additions and 22 deletions

View File

@ -53,10 +53,18 @@ interface LoggedOut {
export function getInitialBackendBaseURL(): string { export function getInitialBackendBaseURL(): string {
const overrideUrl = localStorage.getItem("bank-base-url"); const overrideUrl = localStorage.getItem("bank-base-url");
if (!overrideUrl) {
return canonicalizeBaseUrl( //normal path
overrideUrl ? overrideUrl : bankUiSettings.backendBaseURL, if (!bankUiSettings.backendBaseURL) {
); console.error(
"ERROR: backendBaseURL was overridden by a setting file and missing. Setting value to 'window.origin'",
);
return canonicalizeBaseUrl(window.origin);
}
return canonicalizeBaseUrl(bankUiSettings.backendBaseURL);
}
// testing/development path
return canonicalizeBaseUrl(overrideUrl);
} }
export const defaultState: BackendState = { export const defaultState: BackendState = {

View File

@ -20,15 +20,13 @@ import {
HttpResponsePaginated, HttpResponsePaginated,
useTranslationContext, useTranslationContext,
} from "@gnu-taler/web-util/lib/index.browser"; } from "@gnu-taler/web-util/lib/index.browser";
import { Fragment, h, VNode } from "preact"; import { Fragment, VNode, h } from "preact";
import { Loading } from "../components/Loading.js";
import { Transactions } from "../components/Transactions/index.js"; import { Transactions } from "../components/Transactions/index.js";
import { PageStateType, notifyError } from "../context/pageState.js"; import { useBackendContext } from "../context/backend.js";
import { notifyError } from "../context/pageState.js";
import { useAccountDetails } from "../hooks/access.js"; import { useAccountDetails } from "../hooks/access.js";
import { LoginForm } from "./LoginForm.js"; import { LoginForm } from "./LoginForm.js";
import { PaymentOptions } from "./PaymentOptions.js"; import { PaymentOptions } from "./PaymentOptions.js";
import { StateUpdater } from "preact/hooks";
import { useBackendContext } from "../context/backend.js";
interface Props { interface Props {
account: string; account: string;

View File

@ -48,20 +48,9 @@ export function QrCodeSection({
<p> <p>
<i18n.Translate> <i18n.Translate>
Click{" "} Click{" "}
<a <a href={talerWithdrawUri}>{i18n.str`this taler:// link`}</a> to
id="linkqr" open your Taler wallet
href={talerWithdrawUri}
>{i18n.str`this taler:// link`}</a>{" "}
to open your Taler wallet
</i18n.Translate>{" "} </i18n.Translate>{" "}
<i18n.Translate>
or try{" "}
<a
id="linkqr"
href={"ext+" + talerWithdrawUri}
>{i18n.str`this ext+taler:// link`}</a>{" "}
if your browser does not support <b>taler://</b> scheme.
</i18n.Translate>
</p> </p>
<br /> <br />
<a <a