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

32 lines
891 B
TypeScript

// Metro module 14281 (f14282).
import SavedCustomThemeStore from "./SavedCustomThemeStore";
import { Endpoints } from "../../Constants";
import Dispatcher from "../../Dispatcher";
import { HTTP } from "../../_bundle/sendRequest";
export function fetchUserCustomThemes() {
if (!SavedCustomThemeStore.isFetching()) {
Dispatcher.dispatch({
type: "SAVED_CUSTOM_THEMES_FETCH_START"
});
HTTP.get({
url: Endpoints.USERS_ME_CUSTOM_THEMES,
oldFormErrors: true,
rejectWithError: true
}).then((result) => {
let themes = result.body?.custom_themes;
if (themes == null) {
themes = [];
}
Dispatcher.dispatch({
type: "SAVED_CUSTOM_THEMES_FETCH_SUCCESS",
themes
});
}).catch((a0) => {
Dispatcher.dispatch({
type: "SAVED_CUSTOM_THEMES_FETCH_FAILURE",
error: a0
});
});
}
}