gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant-backoffice] branch master updated: offer 'sign-out' butt


From: gnunet
Subject: [taler-merchant-backoffice] branch master updated: offer 'sign-out' button upon errors
Date: Tue, 25 Jan 2022 09:36:44 +0100

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

ms pushed a commit to branch master
in repository merchant-backoffice.

The following commit(s) were added to refs/heads/master by this push:
     new 0535297  offer 'sign-out' button upon errors
0535297 is described below

commit 0535297f2fa46dbc14bca5bbf604d4ba4b5f5501
Author: ms <ms@taler.net>
AuthorDate: Tue Jan 25 09:36:14 2022 +0100

    offer 'sign-out' button upon errors
---
 packages/bank/src/pages/home/index.tsx | 120 +++++++++++++++++----------------
 1 file changed, 62 insertions(+), 58 deletions(-)

diff --git a/packages/bank/src/pages/home/index.tsx 
b/packages/bank/src/pages/home/index.tsx
index 281c398..2e4c4f1 100644
--- a/packages/bank/src/pages/home/index.tsx
+++ b/packages/bank/src/pages/home/index.tsx
@@ -571,7 +571,7 @@ function Account(Props: any): VNode {
     console.log("account error", error);
     switch(error.status) {
       case 404: {
-        return <p>Username was not found</p>
+        return <p>Username or account label not found</p>
       }
       case 401: {
         return <p>Wrong credentials given</p>
@@ -619,8 +619,8 @@ function Account(Props: any): VNode {
     <p>Your balance is {data.balance.amount}.</p>
     <div>
       <span>{i18n`Last transactions:`}</span> { txsPages }
-      <button onClick={() => setTxPageNumber(txPageNumber + 1)}>{i18n`Load 
more`}</button>
-      <button onClick={() => setTxPageNumber(0)}>{i18n`Reset`}</button>
+      <button onClick={() => setTxPageNumber(txPageNumber + 1)}>{i18n`Load 
more transactions`}</button>
+      <button onClick={() => setTxPageNumber(0)}>{i18n`Reset 
transactions`}</button>
     </div>
     {Props.children}
   </Fragment>);
@@ -729,69 +729,73 @@ export function BankHome(): VNode {
    */
   if (pageState.isLoggedIn) {
     if (typeof backendState === "undefined") {
-      pageStateSetter((prevState) => ({ ...prevState, hasError: true }));
-      return <p>{i18n`Page has a problem: logged in but backend state is 
lost.`}</p>;
+      pageStateSetter((prevState) => ({
+        ...prevState,
+       hasError: true,
+       error: i18n`Page has a problem: logged in but backend state is lost.`
+      }));
+      return <p>Error: waiting for details...</p>;
     }
     return (
       <SWRWithCredentials
         username={backendState.username}
         password={backendState.password}
         backendUrl={backendState.url}>
-
-        <Account
-         withdrawalOutcome={pageState.withdrawalOutcome}
-         talerWithdrawUri={pageState.talerWithdrawUri}
-         accountLabel={backendState.username}>
-          
-         { /* The user is logged in: offer to log out.  */ }
-         <button onClick={() => {
-           setTxPageNumber(0);
+        <Fragment>
+          <Account
+            withdrawalOutcome={pageState.withdrawalOutcome}
+            talerWithdrawUri={pageState.talerWithdrawUri}
+            accountLabel={backendState.username}>
+  
+            { /**
+               * No withdrawal is happening: offer to start one.
+               */
+              !pageState.withdrawalInProgress && <button onClick={() => {
+                createWithdrawalCall(
+                  "EUR:5",
+                  backendState,
+                  pageStateSetter
+                )}}>{i18n`Charge Taler wallet`}</button>
+            }
+  
+            { /**
+               * Withdrawal reached a persisten state: offer to
+               * return back to the pristine profile page.
+               */
+              pageState.withdrawalOutcome && <button onClick={() => {
+                pageStateSetter((prevState) => {
+                  const { withdrawalOutcome, withdrawalId, ...rest } = 
prevState;
+                  return {...rest, withdrawalInProgress: 
false};})}}>{i18n`Close`}</button>
+            }
+  
+            { /**
+               * The withdrawal QR code is rendered: offer to confirm
+               * or abort the operation.
+               */
+              pageState.talerWithdrawUri && <div><button onClick={() => {
+                confirmWithdrawalCall(
+                  backendState,
+                  pageState.withdrawalId,
+                  pageStateSetter);}}>{i18n`Confirm withdrawal`}</button>
+                <button onClick={() => {
+                  abortWithdrawalCall(
+                    backendState,
+                    pageState.withdrawalId,
+                    pageStateSetter);}}>{i18n`Abort withdrawal`}</button>
+            </div>}
+          </Account>
+          { /* The user is logged in: offer to log out.  */ }
+          <button onClick={() => {
+            setTxPageNumber(0);
             pageStateSetter((prevState) => {
               const {
-               talerWithdrawUri,
-               withdrawalOutcome,
-               withdrawalId, ...rest } = prevState;
-               return {...rest, isLoggedIn: false, withdrawalInProgress: 
false};
-           })
-         }}>Sign out</button>
-
-          { /**
-            * No withdrawal is happening: offer to start one.
-            */
-           !pageState.withdrawalInProgress && <button onClick={() => {
-              createWithdrawalCall(
-                "EUR:5",
-                backendState,
-                pageStateSetter
-              )}}>{i18n`Charge Taler wallet`}</button>
-         }
-
-         { /**
-            * Withdrawal reached a persisten state: offer to
-            * return back to the pristine profile page.
-            */
-           pageState.withdrawalOutcome && <button onClick={() => {
-              pageStateSetter((prevState) => {
-               const { withdrawalOutcome, withdrawalId, ...rest } = prevState;
-               return {...rest, withdrawalInProgress: 
false};})}}>{i18n`Close`}</button>
-         }
-
-         { /**
-            * The withdrawal QR code is rendered: offer to confirm
-            * or abort the operation.
-            */
-           pageState.talerWithdrawUri && <div><button onClick={() => {
-              confirmWithdrawalCall(
-                backendState,
-               pageState.withdrawalId,
-               pageStateSetter);}}>{i18n`Confirm withdrawal`}</button>
-              <button onClick={() => {
-                abortWithdrawalCall(
-                  backendState,
-                 pageState.withdrawalId,
-                 pageStateSetter);}}>{i18n`Abort withdrawal`}</button>
-         </div>}
-       </Account>
+                talerWithdrawUri,
+                withdrawalOutcome,
+                withdrawalId, ...rest } = prevState;
+                return {...rest, isLoggedIn: false, withdrawalInProgress: 
false};
+            })
+          }}>Sign out</button>
+        </Fragment>
       </SWRWithCredentials>
     );
   }

-- 
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]