From 46835d5155a561ddf9f3e21bbb81c823c3eab943 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Wed, 7 Dec 2022 16:07:42 -0300
Subject: no-fix: user logger instead of console.log

---
 .../demobank-ui/src/pages/home/AccountPage.tsx     | 37 +++++++++++-----------
 1 file changed, 19 insertions(+), 18 deletions(-)

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

diff --git a/packages/demobank-ui/src/pages/home/AccountPage.tsx b/packages/demobank-ui/src/pages/home/AccountPage.tsx
index 16ff601ec..ddb1e663b 100644
--- a/packages/demobank-ui/src/pages/home/AccountPage.tsx
+++ b/packages/demobank-ui/src/pages/home/AccountPage.tsx
@@ -14,7 +14,7 @@
  GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-import { Amounts, HttpStatusCode } from "@gnu-taler/taler-util";
+import { Amounts, HttpStatusCode, Logger } from "@gnu-taler/taler-util";
 import { hooks } from "@gnu-taler/web-util/lib/index.browser";
 import { ComponentChildren, Fragment, h, VNode } from "preact";
 import { StateUpdater, useEffect } from "preact/hooks";
@@ -28,7 +28,7 @@ import { getIbanFromPayto, prepareHeaders } from "../../utils.js";
 import { BankFrame } from "./BankFrame.js";
 import { LoginForm } from "./LoginForm.js";
 import { PaymentOptions } from "./PaymentOptions.js";
-import { TalerWithdrawalQRCode } from "./TalerWithdrawalQRCode.js";
+import { WithdrawalQRCode } from "./TalerWithdrawalQRCode.js";
 import { Transactions } from "./Transactions.js";
 
 export function AccountPage(): VNode {
@@ -80,6 +80,8 @@ function SWRWithCredentials({
   );
 }
 
+const logger = new Logger("AccountPage");
+
 /**
  * Show only the account's balance.  NOTE: the backend state
  * is mostly needed to provide the user's credentials to POST
@@ -116,7 +118,7 @@ function Account({ accountLabel }: { accountLabel: string }): VNode {
   // }
 
   if (typeof error !== "undefined") {
-    console.log("account error", error, endpoint);
+    logger.trace("account error", error, endpoint);
     /**
      * FIXME: to minimize the code, try only one invocation
      * of pageStateSetter, after having decided the error
@@ -189,12 +191,11 @@ function Account({ accountLabel }: { accountLabel: string }): VNode {
    * brought to this ("Account") page where they get informed about
    * the outcome.
    */
-  console.log(`maybe new withdrawal ${talerWithdrawUri}`);
   if (talerWithdrawUri && withdrawalId) {
-    console.log("Bank created a new Taler withdrawal");
+    logger.trace("Bank created a new Taler withdrawal");
     return (
       <BankFrame>
-        <TalerWithdrawalQRCode
+        <WithdrawalQRCode
           withdrawalId={withdrawalId}
           talerWithdrawUri={talerWithdrawUri}
         />
@@ -252,15 +253,15 @@ function Account({ accountLabel }: { accountLabel: string }): VNode {
   );
 }
 
-function useTransactionPageNumber(): [number, StateUpdater<number>] {
-  const ret = hooks.useNotNullLocalStorage("transaction-page", "0");
-  const retObj = JSON.parse(ret[0]);
-  const retSetter: StateUpdater<number> = function (val) {
-    const newVal =
-      val instanceof Function
-        ? JSON.stringify(val(retObj))
-        : JSON.stringify(val);
-    ret[1](newVal);
-  };
-  return [retObj, retSetter];
-}
+// function useTransactionPageNumber(): [number, StateUpdater<number>] {
+//   const ret = hooks.useNotNullLocalStorage("transaction-page", "0");
+//   const retObj = JSON.parse(ret[0]);
+//   const retSetter: StateUpdater<number> = function (val) {
+//     const newVal =
+//       val instanceof Function
+//         ? JSON.stringify(val(retObj))
+//         : JSON.stringify(val);
+//     ret[1](newVal);
+//   };
+//   return [retObj, retSetter];
+// }
-- 
cgit v1.2.3

