From 7061127c073ba3710c55d13294a75f8bc9b91229 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Wed, 7 Dec 2022 09:30:01 -0300
Subject: fix: empty form should not allow the "send" button

---
 packages/demobank-ui/src/pages/home/index.tsx | 32 +++++++++++++--------------
 1 file changed, 15 insertions(+), 17 deletions(-)

(limited to 'packages/demobank-ui/src/pages/home/index.tsx')

diff --git a/packages/demobank-ui/src/pages/home/index.tsx b/packages/demobank-ui/src/pages/home/index.tsx
index 49fe9e929..7631ebf46 100644
--- a/packages/demobank-ui/src/pages/home/index.tsx
+++ b/packages/demobank-ui/src/pages/home/index.tsx
@@ -916,23 +916,21 @@ function PaytoWireTransfer(Props: any): VNode {
   // submitData.amount === ""
   let parsedAmount = undefined;
 
-  const errorsWire = !submitData
-    ? undefined
-    : undefinedIfEmpty({
-        iban: !submitData.iban
-          ? i18n.str`Missing IBAN`
-          : !/^[A-Z0-9]*$/.test(submitData.iban)
-          ? i18n.str`IBAN should have just uppercased letters and numbers`
-          : undefined,
-        subject: !submitData.subject ? i18n.str`Missing subject` : undefined,
-        amount: !submitData.amount
-          ? i18n.str`Missing amount`
-          : !(parsedAmount = Amounts.parse(`${currency}:${submitData.amount}`))
-          ? i18n.str`Amount is not valid`
-          : Amounts.isZero(parsedAmount)
-          ? i18n.str`Should be greater than 0`
-          : undefined,
-      });
+  const errorsWire = {
+    iban: !submitData?.iban
+      ? i18n.str`Missing IBAN`
+      : !/^[A-Z0-9]*$/.test(submitData.iban)
+      ? i18n.str`IBAN should have just uppercased letters and numbers`
+      : undefined,
+    subject: !submitData?.subject ? i18n.str`Missing subject` : undefined,
+    amount: !submitData?.amount
+      ? i18n.str`Missing amount`
+      : !(parsedAmount = Amounts.parse(`${currency}:${submitData.amount}`))
+      ? i18n.str`Amount is not valid`
+      : Amounts.isZero(parsedAmount)
+      ? i18n.str`Should be greater than 0`
+      : undefined,
+  };
 
   if (!pageState.isRawPayto)
     return (
-- 
cgit v1.2.3

