From fb6aff76d2152d95caa2ba6cb0d91cb01e0687fe Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 6 Jun 2022 00:09:25 -0300 Subject: prettier --- .../src/hooks/useAsyncAsHook.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'packages/taler-wallet-webextension/src/hooks/useAsyncAsHook.ts') diff --git a/packages/taler-wallet-webextension/src/hooks/useAsyncAsHook.ts b/packages/taler-wallet-webextension/src/hooks/useAsyncAsHook.ts index 04a6dbb18..d13a68383 100644 --- a/packages/taler-wallet-webextension/src/hooks/useAsyncAsHook.ts +++ b/packages/taler-wallet-webextension/src/hooks/useAsyncAsHook.ts @@ -13,9 +13,7 @@ You should have received a copy of the GNU General Public License along with TALER; see the file COPYING. If not, see */ -import { - NotificationType, TalerErrorDetail -} from "@gnu-taler/taler-util"; +import { NotificationType, TalerErrorDetail } from "@gnu-taler/taler-util"; import { TalerError } from "@gnu-taler/taler-wallet-core"; import { useEffect, useMemo, useState } from "preact/hooks"; import * as wxApi from "../wxApi.js"; @@ -44,19 +42,23 @@ interface WithRetry { } export type HookResponse = HookOk | HookError | undefined; -export type HookResponseWithRetry = ((HookOk | HookError) & WithRetry) | undefined; +export type HookResponseWithRetry = + | ((HookOk | HookError) & WithRetry) + | undefined; export function useAsyncAsHook( fn: () => Promise, deps?: any[], ): HookResponseWithRetry { - const [result, setHookResponse] = useState>(undefined); - const args = useMemo(() => ({ - fn - // eslint-disable-next-line react-hooks/exhaustive-deps - }), deps || []) + const args = useMemo( + () => ({ + fn, + // eslint-disable-next-line react-hooks/exhaustive-deps + }), + deps || [], + ); async function doAsync(): Promise { try { -- cgit v1.2.3