remove listener on unload
This commit is contained in:
parent
ff49e3477e
commit
78b056a0b1
@ -36,9 +36,12 @@ export function PendingTransactions({ goToTransaction }: Props): VNode {
|
||||
const state = useAsyncAsHook(wxApi.getTransactions);
|
||||
|
||||
useEffect(() => {
|
||||
wxApi.onUpdateNotification([NotificationType.WithdrawGroupFinished], () => {
|
||||
state?.retry();
|
||||
});
|
||||
return wxApi.onUpdateNotification(
|
||||
[NotificationType.WithdrawGroupFinished],
|
||||
() => {
|
||||
state?.retry();
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
const transactions =
|
||||
|
@ -44,9 +44,12 @@ export function BalancePage({
|
||||
const state = useAsyncAsHook(wxApi.getBalance);
|
||||
|
||||
useEffect(() => {
|
||||
wxApi.onUpdateNotification([NotificationType.WithdrawGroupFinished], () => {
|
||||
state?.retry();
|
||||
});
|
||||
return wxApi.onUpdateNotification(
|
||||
[NotificationType.WithdrawGroupFinished],
|
||||
() => {
|
||||
state?.retry();
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
const balances = !state || state.hasError ? [] : state.response.balances;
|
||||
|
@ -54,7 +54,7 @@ export function DeveloperPage(): VNode {
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
wxApi.onUpdateNotification(listenAllEvents, () => {
|
||||
return wxApi.onUpdateNotification(listenAllEvents, () => {
|
||||
response?.retry();
|
||||
});
|
||||
});
|
||||
|
@ -56,9 +56,12 @@ export function HistoryPage({
|
||||
}));
|
||||
|
||||
useEffect(() => {
|
||||
wxApi.onUpdateNotification([NotificationType.WithdrawGroupFinished], () => {
|
||||
state?.retry();
|
||||
});
|
||||
return wxApi.onUpdateNotification(
|
||||
[NotificationType.WithdrawGroupFinished],
|
||||
() => {
|
||||
state?.retry();
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
if (!state) {
|
||||
|
@ -52,7 +52,7 @@ export function ManualWithdrawPage({ currency, onCancel }: Props): VNode {
|
||||
|
||||
const state = useAsyncAsHook(wxApi.listExchanges);
|
||||
useEffect(() => {
|
||||
wxApi.onUpdateNotification([NotificationType.ExchangeAdded], () => {
|
||||
return wxApi.onUpdateNotification([NotificationType.ExchangeAdded], () => {
|
||||
state?.retry();
|
||||
});
|
||||
});
|
||||
|
@ -84,9 +84,12 @@ export function TransactionPage({ tid, goToWalletHistory }: Props): VNode {
|
||||
const state = useAsyncAsHook(() => getTransaction(tid), [tid]);
|
||||
|
||||
useEffect(() => {
|
||||
wxApi.onUpdateNotification([NotificationType.WithdrawGroupFinished], () => {
|
||||
state?.retry();
|
||||
});
|
||||
return wxApi.onUpdateNotification(
|
||||
[NotificationType.WithdrawGroupFinished],
|
||||
() => {
|
||||
state?.retry();
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
if (!state) {
|
||||
|
@ -42,6 +42,7 @@ import {
|
||||
GetFeeForDepositRequest,
|
||||
GetWithdrawalDetailsForUriRequest,
|
||||
KnownBankAccounts,
|
||||
Logger,
|
||||
NotificationType,
|
||||
PrepareDepositRequest,
|
||||
PrepareDepositResponse,
|
||||
@ -76,6 +77,7 @@ import { platform, MessageFromBackend } from "./platform/api.js";
|
||||
export interface ExtendedPermissionsResponse {
|
||||
newValue: boolean;
|
||||
}
|
||||
const logger = new Logger("wxApi");
|
||||
|
||||
/**
|
||||
* Response with information about available version upgrades.
|
||||
@ -106,7 +108,7 @@ async function callBackend(operation: string, payload: any): Promise<any> {
|
||||
console.log("Error calling backend");
|
||||
throw new Error(`Error contacting backend: ${e}`);
|
||||
}
|
||||
console.log("got response", response);
|
||||
logger.info("got response", response);
|
||||
if (response.type === "error") {
|
||||
throw TalerError.fromUncheckedDetail(response.error);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user