aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-04-25 22:37:41 -0300
committerSebastian <sebasjm@gmail.com>2022-04-26 11:48:28 -0300
commit65e6a8caa0de98632ad99cca35bf98bffe663dff (patch)
tree53bd9ec1c376e9cb73c57ba4ce223899c0b0751e /packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
parent1e6b2dd150416d4acfac4cf4068c41edb036d5e0 (diff)
downloadwallet-core-65e6a8caa0de98632ad99cca35bf98bffe663dff.tar.xz
useAsync new API
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx')
-rw-r--r--packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx14
1 files changed, 10 insertions, 4 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
index a54c16754..c70850c6d 100644
--- a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
@@ -23,12 +23,12 @@ import {
import { PendingTaskInfo } from "@gnu-taler/taler-wallet-core";
import { format } from "date-fns";
import { Fragment, h, VNode } from "preact";
-import { useRef, useState } from "preact/hooks";
+import { useEffect, useRef, useState } from "preact/hooks";
import { Diagnostics } from "../components/Diagnostics.js";
import { NotifyUpdateFadeOut } from "../components/styled/index.js";
import { Time } from "../components/Time.js";
import { useTranslationContext } from "../context/translation.js";
-import { useAsyncAsHook } from "../hooks/useAsyncAsHook.js";
+import { useAsyncAsHook2 } from "../hooks/useAsyncAsHook.js";
import { useDiagnostics } from "../hooks/useDiagnostics.js";
import * as wxApi from "../wxApi.js";
@@ -38,7 +38,7 @@ export function DeveloperPage(): VNode {
const listenAllEvents = Array.from<NotificationType>({ length: 1 });
listenAllEvents.includes = () => true; // includes every event
- const response = useAsyncAsHook(async () => {
+ const response = useAsyncAsHook2(async () => {
const op = await wxApi.getPendingOperations();
const c = await wxApi.dumpCoins();
const ex = await wxApi.listExchanges();
@@ -47,7 +47,13 @@ export function DeveloperPage(): VNode {
coins: c.coins,
exchanges: ex.exchanges,
};
- }, listenAllEvents);
+ });
+
+ useEffect(() => {
+ wxApi.onUpdateNotification(listenAllEvents, () => {
+ response?.retry();
+ });
+ });
const nonResponse = { operations: [], coins: [], exchanges: [] };
const { operations, coins, exchanges } =