Files
discord-decomp/modules/media_channel/MediaPostEmbedStore.tsx
T
2026-11-01 12:12:55 +02:00

62 lines
1.5 KiB
TypeScript

// Metro module 10469 (f10470).
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c7016_0 = {
NOT_FETCHED: 0,
0: "NOT_FETCHED",
FETCHING: 1,
1: "FETCHING",
FETCHED: 2,
2: "FETCHED",
FAILED: 3,
3: "FAILED"
};
let c7016_1 = {};
let c7016_2 = {};
class MediaPostEmbedStore extends Module589.Store {
static displayName = "MediaPostEmbedStore";
getMediaPostEmbed(a0) {
if (a0 != null) {
return c7016_1[a0];
}
}
getEmbedFetchState(a0) {
let r4 = c7016_2[a0];
if (r4 == null) {
r4 = c7016_0.NOT_FETCHED;
}
return r4;
}
getMediaPostEmbeds() {
return c7016_1;
}
}
const mediaPostEmbedStore = new MediaPostEmbedStore(Dispatcher, {
CONNECTION_OPEN: function handleConnectionOpen() {
c7016_1 = {};
c7016_2 = {};
},
MEDIA_POST_EMBED_FETCH: function handleFetchMediaPostEmbed(a0) {
c7016_2[a0.threadId] = c7016_0.FETCHING;
},
MEDIA_POST_EMBED_FETCH_SUCCESS: function handleFetchMediaPostEmbedSuccess({ threadId, mediaPostEmbed }) {
const r8 = {
...c7016_1
};
r8[threadId] = mediaPostEmbed;
c7016_1 = r8;
c7016_2[threadId] = c7016_0.FETCHED;
},
MEDIA_POST_EMBED_FETCH_FAILURE: function handleFetchMediaPostFailure(a0) {
c7016_2[a0.threadId] = c7016_0.FAILED;
},
LOGOUT: function handleLogout(a0) {
if (!a0.isSwitchingAccount) {
c7016_1 = {};
c7016_2 = {};
}
}
});
export default mediaPostEmbedStore;
export { c7016_0 as FetchState };