Files
discord-decomp/utils/TrackedHTTPUtils.tsx
T
2026-11-01 12:12:55 +02:00

145 lines
3.7 KiB
TypeScript

// Metro module 4999 (f5000).
import _objectWithoutProperties from "../_bundle/_objectWithoutProperties";
import { HTTP } from "../_bundle/sendRequest";
function $mk75187($env) {
return (a0, a1) => {
const r2 = $env;
let env25310 = {
$parent: $env
};
env25310[0] = a0;
env25310[1] = a1;
(0, r2[0])(r2[2]).then((result) => {
const r8 = env25310.$parent;
const r3 = r8[1];
let properties = r3.properties;
if (typeof r3.properties === "function") {
properties = r3.properties(result);
}
const r4 = env25310.$parent.$parent;
(0, r4[0])(r4[1][1]).trackNetworkAction(r3.event, {
status_code: result.status,
...r8[3],
...properties
});
(0, env25310[0])(result);
}).catch((error) => {
const r10 = env25310.$parent;
const r3 = r10[1];
let properties = r3.properties;
if (typeof r3.properties === "function") {
properties = r3.properties(error);
}
const r15 = env25310.$parent.$parent;
(0, r15[0])(r15[1][1]).trackNetworkAction(r3.event, {
status_code: error.status,
error_code: error.body?.code,
error_message: error.body?.message,
...r10[3],
...properties
});
(0, env25310[1])(error);
});
};
}
let env3007 = {};
const _excluded = ["trackedActionData"];
const r16 = {
get: function get(a0) {
let env14500;
const get2 = HTTP.get;
const r12 = env14500 = {
$parent: env3007
};
env14500[0] = get2;
env14500[1] = void 0;
env14500[2] = void 0;
env14500[3] = void 0;
env14500[1] = a0.trackedActionData;
const rest = _objectWithoutProperties(a0, _excluded);
env14500[2] = rest;
env14500[3] = {
url: rest.url,
request_method: "get"
};
return new Promise($mk75187(r12));
},
post: function post(a0) {
let env14501;
const post2 = HTTP.post;
const r12 = env14501 = {
$parent: env3007
};
env14501[0] = post2;
env14501[1] = void 0;
env14501[2] = void 0;
env14501[3] = void 0;
env14501[1] = a0.trackedActionData;
const rest = _objectWithoutProperties(a0, _excluded);
env14501[2] = rest;
env14501[3] = {
url: rest.url,
request_method: "post"
};
return new Promise($mk75187(r12));
},
put: function put(a0) {
let env14502;
const put2 = HTTP.put;
const r12 = env14502 = {
$parent: env3007
};
env14502[0] = put2;
env14502[1] = void 0;
env14502[2] = void 0;
env14502[3] = void 0;
env14502[1] = a0.trackedActionData;
const rest = _objectWithoutProperties(a0, _excluded);
env14502[2] = rest;
env14502[3] = {
url: rest.url,
request_method: "put"
};
return new Promise($mk75187(r12));
},
patch: function patch(a0) {
let env14503;
const patch2 = HTTP.patch;
const r12 = env14503 = {
$parent: env3007
};
env14503[0] = patch2;
env14503[1] = void 0;
env14503[2] = void 0;
env14503[3] = void 0;
env14503[1] = a0.trackedActionData;
const rest = _objectWithoutProperties(a0, _excluded);
env14503[2] = rest;
env14503[3] = {
url: rest.url,
request_method: "patch"
};
return new Promise($mk75187(r12));
},
delete: function del(a0) {
let env14504;
const del2 = HTTP.del;
const r12 = env14504 = {
$parent: env3007
};
env14504[0] = del2;
env14504[1] = void 0;
env14504[2] = void 0;
env14504[3] = void 0;
env14504[1] = a0.trackedActionData;
const rest = _objectWithoutProperties(a0, _excluded);
env14504[2] = rest;
env14504[3] = {
url: rest.url,
request_method: "del"
};
return new Promise($mk75187(r12));
}
};
export default r16;