diff options
author | Sebastian <sebasjm@gmail.com> | 2023-10-30 19:23:46 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-10-30 19:23:46 -0300 |
commit | d95357381a0a492426be767434c55b489e01c041 (patch) | |
tree | 10f46fb70950313f919a0c41db05cf9abed5baed /packages/demobank-ui | |
parent | f1967ab0baf825cdfa767d36bb7cce78521e4e4b (diff) | |
download | wallet-core-d95357381a0a492426be767434c55b489e01c041.tar.gz wallet-core-d95357381a0a492426be767434c55b489e01c041.tar.bz2 wallet-core-d95357381a0a492426be767434c55b489e01c041.zip |
add the account-not-found case when doing a transaction
Diffstat (limited to 'packages/demobank-ui')
3 files changed, 23 insertions, 1 deletions
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} </div> </Attention> + case "account-not-found": return <Attention type="danger" + title={i18n.str`The operation was rejected due to insufficient funds.`}> + <div class="mt-2 text-sm text-red-700"> + {error.detail.hint} + </div> + </Attention> 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() }} > - <ShowLocalNotification notification={notification} /> + <ShowLocalNotification notification={notification} /> <div class="px-4 py-6 "> <div class="grid max-w-xs grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6"> |