From d95357381a0a492426be767434c55b489e01c041 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 30 Oct 2023 19:23:46 -0300 Subject: add the account-not-found case when doing a transaction --- packages/demobank-ui/src/pages/OperationState/views.tsx | 6 ++++++ packages/demobank-ui/src/pages/PaytoWireTransferForm.tsx | 7 +++++++ packages/demobank-ui/src/pages/WalletWithdrawForm.tsx | 11 ++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) (limited to 'packages/demobank-ui/src') diff --git a/packages/demobank-ui/src/pages/OperationState/views.tsx b/packages/demobank-ui/src/pages/OperationState/views.tsx index 4001fd093..ea38525b9 100644 --- a/packages/demobank-ui/src/pages/OperationState/views.tsx +++ b/packages/demobank-ui/src/pages/OperationState/views.tsx @@ -338,6 +338,12 @@ export function FailedView({ error }: State.Failed) { {error.detail.hint} + case "account-not-found": return +
+ {error.detail.hint} +
+
default: assertUnreachable(error) } } diff --git a/packages/demobank-ui/src/pages/PaytoWireTransferForm.tsx b/packages/demobank-ui/src/pages/PaytoWireTransferForm.tsx index 6649d224e..97e38d75e 100644 --- a/packages/demobank-ui/src/pages/PaytoWireTransferForm.tsx +++ b/packages/demobank-ui/src/pages/PaytoWireTransferForm.tsx @@ -122,6 +122,7 @@ export function PaytoWireTransferForm({ async function doSend() { let payto_uri: PaytoString | undefined; let sendingAmount: AmountString | undefined; + if (credentials.status !== "loggedIn") return; if (rawPaytoInput) { const p = parsePaytoUri(rawPaytoInput) @@ -159,6 +160,12 @@ export function PaytoWireTransferForm({ description: res.detail.hint as TranslatedString, debug: res.detail, }) + case "account-not-found": return notify({ + type: "error", + title: i18n.str`The destination account "${puri}" was not found.`, + description: res.detail.hint as TranslatedString, + debug: res.detail, + }) default: assertUnreachable(res) } } diff --git a/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx b/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx index abdebf9bf..e3a713fdd 100644 --- a/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx +++ b/packages/demobank-ui/src/pages/WalletWithdrawForm.tsx @@ -121,6 +121,15 @@ function OldWithdrawalForm({ goToConfirmOperation, limit, onCancel, focus }: { }) break; } + case "account-not-found": { + notify({ + type: "error", + title: i18n.str`Account not found`, + description: resp.detail.hint as TranslatedString, + debug: resp.detail, + }) + break; + } default: assertUnreachable(resp) } } @@ -135,7 +144,7 @@ function OldWithdrawalForm({ goToConfirmOperation, limit, onCancel, focus }: { e.preventDefault() }} > - +
-- cgit v1.2.3