decord/source/modules/client_themes/SavedCustomThemeActionCreators.tsx
2026-08-13 07:00:46 +00:00

49 lines
1.6 KiB
TypeScript

// Module ID: 14574
// Function ID: 14575
// Name: fetchUserCustomThemes
// Dependencies: [4276, 676, 709, 530, 2]
// Exports: fetchUserCustomThemes
// Module 14574 (fetchUserCustomThemes)
import validateSavedTheme from "validateSavedTheme";
import { Endpoints } from "ME";
const require = arg1;
const result = require("dispatcher").fileFinishedImporting("modules/client_themes/SavedCustomThemeActionCreators.tsx");
export const fetchUserCustomThemes = function fetchUserCustomThemes() {
if (!fetching.isFetching()) {
let obj = importDefault(709);
obj.dispatch({ type: "SAVED_CUSTOM_THEMES_FETCH_START" });
const HTTP = require(530) /* sendRequest */.HTTP;
obj = { url: null, oldFormErrors: true, rejectWithError: true };
obj[0] = Endpoints.USERS_ME_CUSTOM_THEMES;
const value = HTTP.get(obj);
value.then((body) => {
body = body.body;
let custom_themes;
if (body != null) {
custom_themes = body.custom_themes;
}
if (custom_themes == null) {
custom_themes = [];
}
callback(709).dispatch({ type: "SAVED_CUSTOM_THEMES_FETCH_SUCCESS", themes: custom_themes });
}).catch((error) => {
let obj = callback(709);
obj = { type: "SAVED_CUSTOM_THEMES_FETCH_FAILURE", error };
obj.dispatch(obj);
});
const nextPromise = value.then((body) => {
body = body.body;
let custom_themes;
if (body != null) {
custom_themes = body.custom_themes;
}
if (custom_themes == null) {
custom_themes = [];
}
callback(709).dispatch({ type: "SAVED_CUSTOM_THEMES_FETCH_SUCCESS", themes: custom_themes });
});
}
};