gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] 01/02: Improve error handling when adding bank connections


From: gnunet
Subject: [libeufin] 01/02: Improve error handling when adding bank connections
Date: Thu, 02 Jul 2020 18:33:58 +0200

This is an automated email from the git hooks/post-receive script.

heng-yeow pushed a commit to branch master
in repository libeufin.

commit 089b2fd5c6e402bd2606d1e69a9f8ea2c467d28a
Author: tanhengyeow <E0032242@u.nus.edu>
AuthorDate: Fri Jul 3 00:31:30 2020 +0800

    Improve error handling when adding bank connections
---
 .../bank-accounts/AddBankConnectionDrawer.tsx      | 42 ++++++++++++++++------
 1 file changed, 31 insertions(+), 11 deletions(-)

diff --git a/frontend/src/components/bank-accounts/AddBankConnectionDrawer.tsx 
b/frontend/src/components/bank-accounts/AddBankConnectionDrawer.tsx
index 57b85cc..6978192 100644
--- a/frontend/src/components/bank-accounts/AddBankConnectionDrawer.tsx
+++ b/frontend/src/components/bank-accounts/AddBankConnectionDrawer.tsx
@@ -1,5 +1,5 @@
 import React, { useState } from 'react';
-import { Button, Drawer, Input, Form, Steps } from 'antd';
+import { message, Button, Drawer, Input, Form, Steps } from 'antd';
 const { Step } = Steps;
 
 const layout = {
@@ -20,6 +20,10 @@ const AddBankConnectionDrawer = (props) => {
 
   const steps = [{ title: 'Fill up details' }, { title: 'Print document' }];
 
+  const showError = (err) => {
+    message.error(String(err));
+  };
+
   const createBankConnection = async () => {
     const authHeader = await window.localStorage.getItem('authHeader');
     await fetch(`/bank-connections`, {
@@ -109,17 +113,33 @@ const AddBankConnectionDrawer = (props) => {
   };
 
   const next = async () => {
-    await createBankConnection();
-    await connectBankConnection();
-    await fetchKeyLetter();
-    await updateBankAccounts();
+    let isError = true;
+    await createBankConnection()
+      .then(async () => {
+        await connectBankConnection()
+          .then(async () => {
+            await fetchKeyLetter()
+              .then(async () => {
+                await updateBankAccounts()
+                  .then(() => {
+                    isError = false;
+                  })
+                  .catch((err) => showError(err));
+              })
+              .catch((err) => showError(err));
+          })
+          .catch((err) => showError(err));
+      })
+      .catch((err) => showError(err));
 
-    setServerURL('');
-    setHostID('');
-    setPartnerID('');
-    setUserID('');
-    setSystemID('');
-    setCurrentStep(currentStep + 1);
+    if (!isError) {
+      setServerURL('');
+      setHostID('');
+      setPartnerID('');
+      setUserID('');
+      setSystemID('');
+      setCurrentStep(currentStep + 1);
+    }
   };
 
   const closeDrawer = () => {

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]