29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
// Metro module 8066 (f8067).
|
|
import { useEffect } from "react";
|
|
import CollectiblesCategoryStore from "../CollectiblesCategoryStore";
|
|
import CollectiblesPurchaseStore from "../CollectiblesPurchaseStore";
|
|
import { isProfileEffectRecord } from "../records/ProfileEffectRecord";
|
|
import { useStateFromStores } from "../../../_bundle/Module589";
|
|
import { maybeFetchCollectiblesProduct } from "../CollectiblesActionCreators";
|
|
export default function useProfileEffect(a0) {
|
|
let c16234_1;
|
|
const stateFromStores = useStateFromStores([CollectiblesCategoryStore, CollectiblesPurchaseStore], () => {
|
|
if (a0 != null) {
|
|
const product = CollectiblesCategoryStore.getProduct(a0);
|
|
if (isProfileEffectRecord(product == null ? void 0 : product.items[0])) {
|
|
return product.items[0];
|
|
}
|
|
const purchase = CollectiblesPurchaseStore.getPurchase(a0);
|
|
return isProfileEffectRecord(purchase == null ? void 0 : purchase.items[0]) ? purchase.items[0] : void 0;
|
|
}
|
|
});
|
|
const r15 = a0 != null && stateFromStores == null;
|
|
c16234_1 = r15;
|
|
useEffect(() => {
|
|
if (c16234_1) {
|
|
maybeFetchCollectiblesProduct(a0);
|
|
}
|
|
}, [r15, a0]);
|
|
return stateFromStores;
|
|
};
|