diff options
-rw-r--r-- | packages/taler-wallet-webextension/src/wallet/History.tsx | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/History.tsx b/packages/taler-wallet-webextension/src/wallet/History.tsx index ea6057d05..02fc0a76c 100644 --- a/packages/taler-wallet-webextension/src/wallet/History.tsx +++ b/packages/taler-wallet-webextension/src/wallet/History.tsx @@ -52,20 +52,19 @@ export function HistoryPage({ goToWalletDeposit, }: Props): VNode { const { i18n } = useTranslationContext(); - const balance = useAsyncAsHook(wxApi.getBalance); - const balanceWithoutError = balance?.hasError - ? [] - : balance?.response.balances || []; - - const transactionQuery = useAsyncAsHook(wxApi.getTransactions, [ - NotificationType.WithdrawGroupFinished, - ]); + const state = useAsyncAsHook( + async () => ({ + b: await wxApi.getBalance(), + tx: await wxApi.getTransactions(), + }), + [NotificationType.WithdrawGroupFinished], + ); - if (!transactionQuery || !balance) { + if (!state) { return <Loading />; } - if (transactionQuery.hasError) { + if (state.hasError) { return ( <LoadingError title={ @@ -73,18 +72,18 @@ export function HistoryPage({ Could not load the list of transactions </i18n.Translate> } - error={transactionQuery} + error={state} /> ); } return ( <HistoryView - balances={balanceWithoutError} + balances={state.response.b.balances} defaultCurrency={currency} goToWalletManualWithdraw={goToWalletManualWithdraw} goToWalletDeposit={goToWalletDeposit} - transactions={[...transactionQuery.response.transactions].reverse()} + transactions={[...state.response.tx.transactions].reverse()} /> ); } |