59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
// Metro module 15162 (f15163).
|
|
import UnclaimedGamesStore from "./UnclaimedGamesStore";
|
|
import { Endpoints } from "../../Constants";
|
|
import { HTTP } from "../../_bundle/sendRequest";
|
|
import Dispatcher from "../../Dispatcher";
|
|
import { createFetchStore } from "../../_bundle/Module589";
|
|
import Durations from "../../utils/Durations";
|
|
import Backoff from "../../_bundle/Backoff";
|
|
let c10758_6, fetchStore;
|
|
const fetchUnclaimedGames = async function fetchUnclaimedGames() {
|
|
let c27956_1;
|
|
c27956_1 = void 0;
|
|
let c30850_0 = (await HTTP.get({
|
|
url: Endpoints.UNCLAIMED_GAMES,
|
|
oldFormErrors: true,
|
|
rejectWithError: false
|
|
})).body;
|
|
Dispatcher.dispatch({
|
|
type: "UNCLAIMED_GAMES_FETCH_SUCCESS",
|
|
guildIdToGameIds: c30850_0
|
|
});
|
|
};
|
|
c10758_6 = [];
|
|
fetchStore = createFetchStore(UnclaimedGamesStore, {
|
|
getQueryId: (a0) => a0 ? "unclaimed-games" : null,
|
|
get: () => UnclaimedGamesStore.getMap(),
|
|
load: () => fetchUnclaimedGames(),
|
|
staleAfter: Durations.Seconds.DAY,
|
|
retryConfig: {
|
|
backoff: () => new Backoff(5 * Durations.Millis.MINUTE),
|
|
maxRetries: 10
|
|
}
|
|
});
|
|
const r36 = {
|
|
fetch: fetchUnclaimedGames
|
|
};
|
|
export default r36;
|
|
export { fetchUnclaimedGames };
|
|
export { fetchStore as useUnclaimedGames };
|
|
export function useUnclaimedGameIdsForGuild(a0, r5 = true) {
|
|
const data = fetchStore(r5).data;
|
|
let r8 = data == null ? void 0 : data[a0];
|
|
if (r8 == null) {
|
|
r8 = c10758_6;
|
|
}
|
|
return r8;
|
|
}
|
|
export function useHasUnclaimedGames(a0, r6 = true) {
|
|
if (r6 === void 0) {
|
|
r6 = true;
|
|
}
|
|
const data = fetchStore(r6).data;
|
|
let r9 = data == null ? void 0 : data[a0];
|
|
if (r9 == null) {
|
|
r9 = c10758_6;
|
|
}
|
|
return r9.length > 0;
|
|
}
|