decord/source/modules/game_profile/hooks/useGameAnnouncements.tsx
github-actions da5b5e5efe chore: update source for alpha 346.6
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
2026-09-12 13:45:10 +00:00

73 lines
2.2 KiB
TypeScript

// Module ID: 8885
// Function ID: 8886
// Name: useGameAnnouncements
// Dependencies: [19, 8805, 504, 8886, 2]
// Exports: default
// Module 8885 (useGameAnnouncements)
import _mod19 from "module_19" /* 19 */;
import GameProfileHttpUtils from "GameProfileHttpUtils" /* 8886 */;
import GameProfileStore from "GameProfileStore" /* 8805 */;
import size from "module_2" /* 2 */;
const require = globalThis.__r;
const useEffect = _mod19.useEffect;
let result = size.fileFinishedImporting("modules/game_profile/hooks/useGameAnnouncements.tsx");
export default function useGameAnnouncements(arg0, limit) {
_require = arg0;
dependencyMap = limit;
const items = [GameProfileStore];
const stateFromStoresObject = require("initialize").useStateFromStoresObject(items, () => {
let announcements;
if (null != closure_0) {
announcements = GameProfileStore.getAnnouncements(tmp);
}
const obj = { data: announcements, hasFetched: null, isFetching: null };
let result = null != tmp;
if (result) {
result = GameProfileStore.hasAnnouncementsBeenFetched(tmp);
}
obj.hasFetched = result;
let result1 = null != tmp;
if (result1) {
result1 = GameProfileStore.isAnnouncementsFetching(tmp);
}
obj.isFetching = result1;
return obj;
});
({ data, hasFetched } = stateFromStoresObject);
const items1 = [arg0, hasFetched, limit];
hasFetched(() => {
let result = null == closure_0 || hasFetched;
if (!result) {
result = GameProfileStore.isAnnouncementsFetching(tmp);
}
if (!result) {
const obj2 = { limit };
const gameAnnouncements = GameProfileHttpUtils.getGameAnnouncements(tmp, obj2);
}
}, items1);
let messages;
if (data != null) {
messages = data.messages;
}
if (messages == null) {
messages = [];
}
let obj2 = { messages, channelId: null, guildId: null, loading: null, hasFetched: null };
let channelId;
if (data != null) {
channelId = data.channelId;
}
obj2.channelId = channelId;
let guildId;
if (data != null) {
guildId = data.guildId;
}
obj2.guildId = guildId;
obj2.loading = stateFromStoresObject.isFetching;
obj2.hasFetched = hasFetched;
return obj2;
};