From 9fb0e7d0b386a1b10a39d0b664131590cd0c3a68 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Thu, 22 Dec 2022 18:38:21 -0300
Subject: prevent form submit

---
 .../src/pages/WithdrawalConfirmationQuestion.tsx       | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

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

diff --git a/packages/demobank-ui/src/pages/WithdrawalConfirmationQuestion.tsx b/packages/demobank-ui/src/pages/WithdrawalConfirmationQuestion.tsx
index 8cfdd4e9f..9fdd8ad59 100644
--- a/packages/demobank-ui/src/pages/WithdrawalConfirmationQuestion.tsx
+++ b/packages/demobank-ui/src/pages/WithdrawalConfirmationQuestion.tsx
@@ -47,7 +47,13 @@ export function WithdrawalConfirmationQuestion(): VNode {
       <h1 class="nav">{i18n.str`Confirm Withdrawal`}</h1>
       <article>
         <div class="challenge-div">
-          <form class="challenge-form" noValidate>
+          <form
+            class="challenge-form"
+            noValidate
+            onSubmit={(e) => {
+              e.preventDefault();
+            }}
+          >
             <div class="pure-form" id="captcha" name="capcha-form">
               <h2>{i18n.str`Authorize withdrawal by solving challenge`}</h2>
               <p>
@@ -72,8 +78,9 @@ export function WithdrawalConfirmationQuestion(): VNode {
               </p>
               <p>
                 <button
+                  type="submit"
                   class="pure-button pure-button-primary btn-confirm"
-                  onClick={(e) => {
+                  onClick={async (e) => {
                     e.preventDefault();
                     if (
                       captchaAnswer ==
@@ -101,14 +108,15 @@ export function WithdrawalConfirmationQuestion(): VNode {
                 &nbsp;
                 <button
                   class="pure-button pure-button-secondary btn-cancel"
-                  onClick={async () =>
+                  onClick={async (e) => {
+                    e.preventDefault();
                     await abortWithdrawalCall(
                       backend.state,
                       pageState.withdrawalId,
                       pageStateSetter,
                       i18n,
-                    )
-                  }
+                    );
+                  }}
                 >
                   {i18n.str`Cancel`}
                 </button>
-- 
cgit v1.2.3

