decord/alpha/source/actions/ConsentActionCreators.tsx

76 lines
2.3 KiB
TypeScript
Raw Permalink Normal View History

2026-10-13 12:43:34 +00:00
// Module ID: 15455
// Function ID: 15456
// Name: ConsentActionCreators
2026-10-09 10:00:15 +00:00
// Dependencies: [1085, 584, 1126, 1295, 2]
2026-07-20 16:05:17 +00:00
// Exports: fetchConsents, setConsents
2026-10-13 12:43:34 +00:00
// Module 15455 (ConsentActionCreators)
2026-10-03 08:58:59 +00:00
import DispatcherDefault from "Dispatcher" /* 584 */;
import Constants from "Constants" /* 1085 */;
import intl3 from "intl" /* 1126 */;
2026-10-09 10:00:15 +00:00
import HTTPUtils from "HTTPUtils" /* 1295 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-07-20 16:05:17 +00:00
function handleRequestSuccess(body) {
2026-10-03 08:58:59 +00:00
let obj2;
const tmp = null != body && null != body.body;
2026-07-20 16:05:17 +00:00
if (tmp) {
2026-10-03 08:58:59 +00:00
const obj = { type: "UPDATE_CONSENTS", consents: obj2 };
obj2 = {};
const dispatch = DispatcherDefault.dispatch;
DispatcherDefault;
2026-07-20 16:05:17 +00:00
const merged = Object.assign(body.body);
2026-10-03 08:58:59 +00:00
dispatch(obj);
2026-07-20 16:05:17 +00:00
}
return body.body;
}
function handleRequestFailure(status) {
2026-10-03 08:58:59 +00:00
let message;
2026-07-20 16:05:17 +00:00
if (status.status >= 500) {
if (status.status <= 599) {
2026-10-03 08:58:59 +00:00
const intl2 = intl3.intl;
message = intl2.string(intl3.t.cvJdtg);
2026-07-20 16:05:17 +00:00
}
const _Error = Error;
2026-10-03 08:58:59 +00:00
const self = this;
const self2 = this;
const error = new Error(message);
2026-07-20 16:05:17 +00:00
throw error;
}
if (null != status) {
if (null != status.body) {
if (null != status.body.message) {
message = status.body.message;
}
}
}
2026-10-03 08:58:59 +00:00
const intl = intl3.intl;
message = intl.string(intl3.t.cvJdtg);
2026-07-20 16:05:17 +00:00
}
const Endpoints = Constants.Endpoints;
const result = size.fileFinishedImporting("actions/ConsentActionCreators.tsx");
2026-07-20 16:05:17 +00:00
export const fetchConsents = function fetchConsents() {
2026-10-03 08:58:59 +00:00
let obj2;
const HTTP = HTTPUtils.HTTP;
2026-10-03 08:58:59 +00:00
const get = HTTP.get;
const obj = { url: Endpoints.SETTINGS_CONSENT, oldFormErrors: true, rejectWithError: obj2.rejectWithMigratedError() };
obj2 = HTTPUtils;
const value = get(obj);
2026-07-20 16:05:17 +00:00
return value.then(handleRequestSuccess, (body) => {
const error = new Error(body.body.message);
2026-10-03 08:58:59 +00:00
return reject(error);
2026-07-20 16:05:17 +00:00
});
};
export const setConsents = function setConsents(items, items2) {
2026-10-03 08:58:59 +00:00
let obj;
let obj3;
const HTTP = HTTPUtils.HTTP;
2026-10-03 08:58:59 +00:00
const request = { url: Endpoints.SETTINGS_CONSENT, body: obj, oldFormErrors: true, rejectWithError: obj3.rejectWithMigratedError() };
const post = HTTP.post;
obj = { grant: items, revoke: items2 };
obj3 = HTTPUtils;
const postResult = post(request);
return postResult.then(handleRequestSuccess, handleRequestFailure);
2026-07-20 16:05:17 +00:00
};