27 lines
1014 B
TypeScript
27 lines
1014 B
TypeScript
// Metro module 8720 (f8721).
|
|
import { useEffect } from "react";
|
|
import VirtualCurrencyStore from "../stores/VirtualCurrencyStore";
|
|
import { useStateFromStoresObject } from "../../../_bundle/Module589";
|
|
import { fetchVirtualCurrencyBalance } from "../VirtualCurrencyActionCreators";
|
|
export function useFetchVirtualCurrencyBalance(a0) {
|
|
let balance, error;
|
|
const stateFromStoresObject = useStateFromStoresObject([VirtualCurrencyStore], () => ({
|
|
balance: VirtualCurrencyStore.balance,
|
|
isFetching: VirtualCurrencyStore.isFetchingBalance,
|
|
error: VirtualCurrencyStore.fetchBalanceError
|
|
}));
|
|
balance = stateFromStoresObject.balance;
|
|
const isFetching = stateFromStoresObject.isFetching;
|
|
error = stateFromStoresObject.error;
|
|
useEffect(() => {
|
|
if (!(a0?.disableFetch || balance !== null || error !== null || VirtualCurrencyStore.isFetchingBalance)) {
|
|
fetchVirtualCurrencyBalance();
|
|
}
|
|
}, [balance, error, a0?.disableFetch]);
|
|
return {
|
|
balance,
|
|
isFetching,
|
|
error
|
|
};
|
|
}
|