decord/source/modules/client_themes/SavedCustomThemeActionCreators.tsx

52 lines
1.7 KiB
TypeScript
Raw Normal View History

// Module ID: 15267
// Function ID: 15268
2026-07-20 16:05:17 +00:00
// Name: fetchUserCustomThemes
// Dependencies: [4493, 1074, 573, 1272, 2]
2026-07-20 16:05:17 +00:00
// Exports: fetchUserCustomThemes
// Module 15267 (fetchUserCustomThemes)
import dispatcherDefault from "dispatcher" /* 573 */;
import sendRequest from "sendRequest" /* 1272 */;
import closure_3 from "validateSavedTheme" /* 4493 */;
import { Endpoints } from "ME" /* 1074 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
const result = require("set").fileFinishedImporting("modules/client_themes/SavedCustomThemeActionCreators.tsx");
2026-07-20 16:05:17 +00:00
export const fetchUserCustomThemes = function fetchUserCustomThemes() {
if (!fetching.isFetching()) {
2026-08-24 06:08:38 +00:00
let obj = dispatcherDefault;
2026-07-29 08:29:29 +00:00
obj.dispatch({ type: "SAVED_CUSTOM_THEMES_FETCH_START" });
2026-08-24 06:08:38 +00:00
const HTTP = sendRequest.HTTP;
2026-07-29 08:29:29 +00:00
obj = { url: null, oldFormErrors: true, rejectWithError: true };
obj[0] = Endpoints.USERS_ME_CUSTOM_THEMES;
2026-07-20 16:05:17 +00:00
const value = HTTP.get(obj);
value.then((body) => {
body = body.body;
let custom_themes;
2026-07-29 08:29:29 +00:00
if (body != null) {
2026-07-20 16:05:17 +00:00
custom_themes = body.custom_themes;
}
2026-07-29 08:29:29 +00:00
if (custom_themes == null) {
2026-07-20 16:05:17 +00:00
custom_themes = [];
}
callback(573).dispatch({ type: "SAVED_CUSTOM_THEMES_FETCH_SUCCESS", themes: custom_themes });
2026-07-20 16:05:17 +00:00
}).catch((error) => {
let obj = callback(573);
2026-07-20 16:05:17 +00:00
obj = { type: "SAVED_CUSTOM_THEMES_FETCH_FAILURE", error };
obj.dispatch(obj);
});
const nextPromise = value.then((body) => {
body = body.body;
let custom_themes;
2026-07-29 08:29:29 +00:00
if (body != null) {
2026-07-20 16:05:17 +00:00
custom_themes = body.custom_themes;
}
2026-07-29 08:29:29 +00:00
if (custom_themes == null) {
2026-07-20 16:05:17 +00:00
custom_themes = [];
}
callback(573).dispatch({ type: "SAVED_CUSTOM_THEMES_FETCH_SUCCESS", themes: custom_themes });
2026-07-20 16:05:17 +00:00
});
}
};