summaryrefslogtreecommitdiff
path: root/packages/demobank-ui/src/pages/home/WalletWithdrawForm.tsx
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-12-07 16:07:42 -0300
committerSebastian <sebasjm@gmail.com>2022-12-07 16:08:20 -0300
commit46835d5155a561ddf9f3e21bbb81c823c3eab943 (patch)
tree51011d2bae21b66695e3854ed49b9c63f5f35255 /packages/demobank-ui/src/pages/home/WalletWithdrawForm.tsx
parent1c6369677ab272196da314d95825273c6fff8d5f (diff)
downloadwallet-core-46835d5155a561ddf9f3e21bbb81c823c3eab943.tar.gz
wallet-core-46835d5155a561ddf9f3e21bbb81c823c3eab943.tar.bz2
wallet-core-46835d5155a561ddf9f3e21bbb81c823c3eab943.zip
no-fix: user logger instead of console.log
Diffstat (limited to 'packages/demobank-ui/src/pages/home/WalletWithdrawForm.tsx')
-rw-r--r--packages/demobank-ui/src/pages/home/WalletWithdrawForm.tsx11
1 files changed, 7 insertions, 4 deletions
diff --git a/packages/demobank-ui/src/pages/home/WalletWithdrawForm.tsx b/packages/demobank-ui/src/pages/home/WalletWithdrawForm.tsx
index ee43d2006..29fc1eb6a 100644
--- a/packages/demobank-ui/src/pages/home/WalletWithdrawForm.tsx
+++ b/packages/demobank-ui/src/pages/home/WalletWithdrawForm.tsx
@@ -14,6 +14,7 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
+import { Logger } from "@gnu-taler/taler-util";
import { h, VNode } from "preact";
import { StateUpdater, useEffect, useRef } from "preact/hooks";
import { useBackendContext } from "../../context/backend.js";
@@ -22,6 +23,8 @@ import { useTranslationContext } from "../../context/translation.js";
import { BackendState } from "../../hooks/backend.js";
import { prepareHeaders, validateAmount } from "../../utils.js";
+const logger = new Logger("WalletWithdrawForm");
+
export function WalletWithdrawForm({
focus,
currency,
@@ -110,7 +113,7 @@ async function createWithdrawalCall(
pageStateSetter: StateUpdater<PageStateType>,
): Promise<void> {
if (backendState?.status === "loggedOut") {
- console.log("Page has a problem: no credentials found in the state.");
+ logger.error("Page has a problem: no credentials found in the state.");
pageStateSetter((prevState) => ({
...prevState,
@@ -137,7 +140,7 @@ async function createWithdrawalCall(
body: JSON.stringify({ amount }),
});
} catch (error) {
- console.log("Could not POST withdrawal request to the bank", error);
+ logger.trace("Could not POST withdrawal request to the bank", error);
pageStateSetter((prevState) => ({
...prevState,
@@ -151,7 +154,7 @@ async function createWithdrawalCall(
}
if (!res.ok) {
const response = await res.json();
- console.log(
+ logger.error(
`Withdrawal creation gave response error: ${response} (${res.status})`,
);
pageStateSetter((prevState) => ({
@@ -166,7 +169,7 @@ async function createWithdrawalCall(
return;
}
- console.log("Withdrawal operation created!");
+ logger.trace("Withdrawal operation created!");
const resp = await res.json();
pageStateSetter((prevState: PageStateType) => ({
...prevState,