aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-03-13 00:01:59 -0300
committerSebastian <sebasjm@gmail.com>2023-03-13 00:01:59 -0300
commita1af7945d17d40b33aeaf3894ed348b083f98f9a (patch)
tree2d54cfc75abc5bc880cfe08dae8d5f6471142320
parentb874f9a0c50084803de58febb698864aa8dd061a (diff)
fix broken build
-rw-r--r--packages/demobank-ui/src/pages/AdminPage.tsx11
1 files changed, 8 insertions, 3 deletions
diff --git a/packages/demobank-ui/src/pages/AdminPage.tsx b/packages/demobank-ui/src/pages/AdminPage.tsx
index 3dd34d251..f565455bb 100644
--- a/packages/demobank-ui/src/pages/AdminPage.tsx
+++ b/packages/demobank-ui/src/pages/AdminPage.tsx
@@ -224,8 +224,13 @@ export function AdminPage({ onLoadNotOk }: Props): VNode {
return onLoadNotOk(result);
}
const { data } = result;
- const balance = Amounts.parse(data.balance.amount);
- const balanceIsDebit = data.balance.credit_debit_indicator == "debit";
+ const balance = Amounts.parseOrThrow(data.balance.amount);
+ const debitThreshold = Amounts.parseOrThrow(result.data.debitThreshold);
+ const balanceIsDebit =
+ result.data.balance.credit_debit_indicator == "debit";
+ const limit = balanceIsDebit
+ ? Amounts.sub(debitThreshold, balance).amount
+ : Amounts.add(balance, debitThreshold).amount;
if (!balance) return <Fragment />;
return (
<Fragment>
@@ -250,7 +255,7 @@ export function AdminPage({ onLoadNotOk }: Props): VNode {
</section>
<PaytoWireTransferForm
focus
- currency={balance.currency}
+ limit={limit}
onSuccess={() => {
pageStateSetter((prevState: PageStateType) => ({
...prevState,