decord/source/modules/client_themes/SavedCustomThemeActionCreators.tsx

50 lines
1.6 KiB
TypeScript
Raw Normal View History

2026-07-31 08:44:05 +00:00
// Module ID: 14300
// Function ID: 14301
2026-07-20 16:05:17 +00:00
// Name: fetchUserCustomThemes
2026-07-31 08:44:05 +00:00
// Dependencies: [4127, 676, 709, 530, 2]
2026-07-20 16:05:17 +00:00
// Exports: fetchUserCustomThemes
2026-07-31 08:44:05 +00:00
// Module 14300 (fetchUserCustomThemes)
2026-07-29 08:29:29 +00:00
import validateSavedTheme from "validateSavedTheme";
2026-07-23 10:11:24 +00:00
import { Endpoints } from "ME";
const require = arg1;
const result = require("dispatcher").fileFinishedImporting("modules/client_themes/SavedCustomThemeActionCreators.tsx");
2026-07-20 16:05:17 +00:00
export const fetchUserCustomThemes = function fetchUserCustomThemes() {
if (!fetching.isFetching()) {
2026-07-29 08:29:29 +00:00
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;
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 = [];
}
2026-07-29 08:29:29 +00:00
callback(709).dispatch({ type: "SAVED_CUSTOM_THEMES_FETCH_SUCCESS", themes: custom_themes });
2026-07-20 16:05:17 +00:00
}).catch((error) => {
2026-07-29 08:29:29 +00:00
let obj = callback(709);
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 = [];
}
2026-07-29 08:29:29 +00:00
callback(709).dispatch({ type: "SAVED_CUSTOM_THEMES_FETCH_SUCCESS", themes: custom_themes });
2026-07-20 16:05:17 +00:00
});
}
};