decord/source/actions/ConsentActionCreators.tsx

65 lines
2.1 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 14310
// Function ID: 14311
2026-07-20 16:05:17 +00:00
// Name: handleRequestSuccess
2026-07-29 08:29:29 +00:00
// Dependencies: [676, 709, 1236, 530, 2]
2026-07-20 16:05:17 +00:00
// Exports: fetchConsents, setConsents
2026-08-25 06:04:03 +00:00
// Module 14310 (handleRequestSuccess)
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
import sendRequest from "sendRequest" /* 530 */;
import ME from "ME" /* 676 */;
import dispatcherDefault from "dispatcher" /* 709 */;
import getSystemLocale from "getSystemLocale" /* 1236 */;
2026-07-23 10:11:24 +00:00
2026-07-20 16:05:17 +00:00
function handleRequestSuccess(body) {
if (tmp) {
2026-08-24 06:08:38 +00:00
let obj = dispatcherDefault;
2026-07-29 08:29:29 +00:00
obj = { type: "UPDATE_CONSENTS", consents: null };
2026-07-20 16:05:17 +00:00
obj = {};
const merged = Object.assign(body.body);
2026-07-29 08:29:29 +00:00
obj[1] = obj;
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
}
return body.body;
}
function handleRequestFailure(status) {
if (status.status >= 500) {
if (status.status <= 599) {
2026-08-24 06:08:38 +00:00
const intl2 = getSystemLocale.intl;
let message = intl2.string(getSystemLocale.t.cvJdtg);
2026-07-20 16:05:17 +00:00
}
const _Error = Error;
2026-08-24 06:08:38 +00:00
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-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
message = intl.string(getSystemLocale.t.cvJdtg);
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
const Endpoints = ME.Endpoints;
const result = set.fileFinishedImporting("actions/ConsentActionCreators.tsx");
2026-07-20 16:05:17 +00:00
export const fetchConsents = function fetchConsents() {
2026-08-24 06:08:38 +00:00
const HTTP = sendRequest.HTTP;
const obj = { url: Endpoints.SETTINGS_CONSENT, oldFormErrors: true, rejectWithError: sendRequest.rejectWithMigratedError() };
2026-07-20 16:05:17 +00:00
const value = HTTP.get(obj);
return value.then(handleRequestSuccess, (body) => {
2026-08-24 06:08:38 +00:00
error = new Error(body.body.message);
2026-07-20 16:05:17 +00:00
return Promise.reject(error);
});
};
export const setConsents = function setConsents(items, items2) {
2026-08-24 06:08:38 +00:00
const HTTP = sendRequest.HTTP;
2026-07-29 08:29:29 +00:00
obj = { url: Endpoints.SETTINGS_CONSENT, body: obj, oldFormErrors: true, rejectWithError: null };
obj = { grant: items, revoke: items2 };
2026-08-24 06:08:38 +00:00
obj[3] = sendRequest.rejectWithMigratedError();
const obj3 = sendRequest;
2026-07-20 16:05:17 +00:00
return HTTP.post(obj).then(handleRequestSuccess, handleRequestFailure);
};