diff options
author | Sebastian <sebasjm@gmail.com> | 2023-03-11 18:19:38 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-03-11 18:20:16 -0300 |
commit | c67d94c56e154be4b2cf91572cdc2d8d2da7f8e4 (patch) | |
tree | fbb9444857d4e11f348c051b9c470e9295990096 /packages/demobank-ui/src/hooks | |
parent | b72729f06535f12af974035b141a30320e75575c (diff) | |
download | wallet-core-c67d94c56e154be4b2cf91572cdc2d8d2da7f8e4.tar.xz |
fix: #7753
Diffstat (limited to 'packages/demobank-ui/src/hooks')
-rw-r--r-- | packages/demobank-ui/src/hooks/access.ts | 17 | ||||
-rw-r--r-- | packages/demobank-ui/src/hooks/circuit.ts | 6 |
2 files changed, 16 insertions, 7 deletions
diff --git a/packages/demobank-ui/src/hooks/access.ts b/packages/demobank-ui/src/hooks/access.ts index 8282210d4..750b95fa0 100644 --- a/packages/demobank-ui/src/hooks/access.ts +++ b/packages/demobank-ui/src/hooks/access.ts @@ -31,6 +31,7 @@ import { // FIX default import https://github.com/microsoft/TypeScript/issues/49189 import _useSWR, { SWRHook } from "swr"; +import { Amounts } from "@gnu-taler/taler-util"; const useSWR = _useSWR as unknown as SWRHook; export function useAccessAPI(): AccessAPI { @@ -180,7 +181,21 @@ export function useAccountDetails( keepPreviousData: true, }); - if (data) return data; + //FIXME: remove optional when libeufin sandbox has implemented the feature + if (data && typeof data.data.debitThreshold === "undefined") { + data.data.debitThreshold = "100"; + } + //FIXME: sandbox server should return amount string + if (data) { + const d = structuredClone(data); + const { currency } = Amounts.parseOrThrow(data.data.balance.amount); + d.data.debitThreshold = Amounts.stringify({ + currency, + value: Number.parseInt(d.data.debitThreshold, 10), + fraction: 0, + }); + return d; + } if (error) return error.info; return { loading: true }; } diff --git a/packages/demobank-ui/src/hooks/circuit.ts b/packages/demobank-ui/src/hooks/circuit.ts index 423ed1a5b..548862d85 100644 --- a/packages/demobank-ui/src/hooks/circuit.ts +++ b/packages/demobank-ui/src/hooks/circuit.ts @@ -299,12 +299,6 @@ export function useRatiosAndFeeConfig(): HttpResponse< keepPreviousData: true, }); - if (data) { - // data.data.ratios_and_fees.sell_out_fee = 2 - if (!data.data.ratios_and_fees.fiat_currency) { - data.data.ratios_and_fees.fiat_currency = "FIAT"; - } - } if (data) return data; if (error) return error.info; return { loading: true }; |