aboutsummaryrefslogtreecommitdiff
path: root/packages/demobank-ui/src/pages/AccountPage/state.ts
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-09-22 18:34:49 -0300
committerSebastian <sebasjm@gmail.com>2023-09-25 14:50:44 -0300
commit15af6c619de70336bcdfbabbd32b9d93aabefc5b (patch)
tree5dff83b07f9ffcb26cd4eb595f9e80f549ae25b5 /packages/demobank-ui/src/pages/AccountPage/state.ts
parent5640f0a67dcc31fa2b5fa0992abca8a55bc00dd8 (diff)
downloadwallet-core-15af6c619de70336bcdfbabbd32b9d93aabefc5b.tar.xz
towards new core bank api
Diffstat (limited to 'packages/demobank-ui/src/pages/AccountPage/state.ts')
-rw-r--r--packages/demobank-ui/src/pages/AccountPage/state.ts16
1 files changed, 11 insertions, 5 deletions
diff --git a/packages/demobank-ui/src/pages/AccountPage/state.ts b/packages/demobank-ui/src/pages/AccountPage/state.ts
index 1a1475c0d..b12afbf9e 100644
--- a/packages/demobank-ui/src/pages/AccountPage/state.ts
+++ b/packages/demobank-ui/src/pages/AccountPage/state.ts
@@ -40,7 +40,7 @@ export function useComponentState({ account, goToBusinessAccount, goToConfirmOpe
};
}
//logout if there is any error, not if loading
- backend.logOut();
+ // backend.logOut();
if (result.status === HttpStatusCode.NotFound) {
notifyError(i18n.str`Username or account label "${account}" not found`, undefined);
return {
@@ -55,9 +55,13 @@ export function useComponentState({ account, goToBusinessAccount, goToConfirmOpe
}
const { data } = result;
- const balance = Amounts.parseOrThrow(data.balance.amount);
- const debitThreshold = Amounts.parseOrThrow(data.debitThreshold);
- const payto = parsePaytoUri(data.paytoUri);
+
+ // FIXME: balance
+ // const balance = Amounts.parseOrThrow(data.balance.amount);
+ const balance = Amounts.parseOrThrow(data.balance);
+
+ const debitThreshold = Amounts.parseOrThrow(data.debit_threshold);
+ const payto = parsePaytoUri(data.payto_uri);
if (!payto || !payto.isKnown || (payto.targetType !== "iban" && payto.targetType !== "x-taler-bank")) {
return {
@@ -66,7 +70,9 @@ export function useComponentState({ account, goToBusinessAccount, goToConfirmOpe
};
}
- const balanceIsDebit = data.balance.credit_debit_indicator == "debit";
+ // FIXME: balance
+ const balanceIsDebit = true;
+ // data.balance.credit_debit_indicator == "debit";
const limit = balanceIsDebit
? Amounts.sub(debitThreshold, balance).amount
: Amounts.add(balance, debitThreshold).amount;