decord/source/modules/virtual_currency/hooks/useFetchVirtualCurrencyBalance.tsx

50 lines
1.8 KiB
TypeScript
Raw Normal View History

// Module ID: 8990
// Function ID: 8991
2026-07-20 16:05:17 +00:00
// Name: useFetchVirtualCurrencyBalance
// Dependencies: [19, 8991, 504, 8992, 2]
2026-07-20 16:05:17 +00:00
// Exports: useFetchVirtualCurrencyBalance
// Module 8990 (useFetchVirtualCurrencyBalance)
import _mod19 from "module_19" /* 19 */;
import VirtualCurrencyActionCreators from "VirtualCurrencyActionCreators" /* 8992 */;
import VirtualCurrencyStore from "VirtualCurrencyStore" /* 8991 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
const require = globalThis.__r;
const useEffect = _mod19.useEffect;
const result = size.fileFinishedImporting("modules/virtual_currency/hooks/useFetchVirtualCurrencyBalance.tsx");
2026-07-20 16:05:17 +00:00
export const useFetchVirtualCurrencyBalance = function useFetchVirtualCurrencyBalance(disableFetch) {
_require = disableFetch;
const items = [VirtualCurrencyStore];
const isFetching = require("initialize").useStateFromStoresObject(items, () => ({ balance: VirtualCurrencyStore.balance, isFetching: VirtualCurrencyStore.isFetchingBalance, error: VirtualCurrencyStore.fetchBalanceError }));
2026-07-23 10:11:24 +00:00
balance = isFetching.balance;
const error = isFetching.error;
2026-07-20 16:05:17 +00:00
const items1 = [balance, error, ];
disableFetch = undefined;
2026-07-29 08:29:29 +00:00
if (disableFetch != null) {
2026-07-20 16:05:17 +00:00
disableFetch = disableFetch.disableFetch;
}
items1[2] = disableFetch;
2026-07-23 10:11:24 +00:00
error(() => {
2026-08-24 06:08:38 +00:00
disableFetch = undefined;
2026-07-29 08:29:29 +00:00
if (disableFetch != null) {
disableFetch = disableFetch.disableFetch;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!disableFetch) {
disableFetch = null !== balance;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!disableFetch) {
disableFetch = null !== error;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!disableFetch) {
disableFetch = VirtualCurrencyStore.isFetchingBalance;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!disableFetch) {
const virtualCurrencyBalance = VirtualCurrencyActionCreators.fetchVirtualCurrencyBalance();
2026-07-20 16:05:17 +00:00
}
}, items1);
return { balance, isFetching: isFetching.isFetching, error };
};