47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
System.register(["cc"], function (_export, _context) {
|
|
"use strict";
|
|
|
|
var _cclegacy, _crd;
|
|
|
|
return {
|
|
setters: [function (_cc) {
|
|
_cclegacy = _cc.cclegacy;
|
|
}],
|
|
execute: function () {
|
|
_crd = true;
|
|
|
|
_cclegacy._RF.push({}, "5996a3xpdxGV52P28C8e5pq", "ajax", undefined);
|
|
|
|
_export("default", {
|
|
// hosturl: "http://192.168.2.36:8080",
|
|
hosturl: "http://192.168.2.45:8080",
|
|
|
|
sendAjax(url, data, method, callback) {
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.open(method, this.hosturl + url, true);
|
|
var token = localStorage.getItem("token");
|
|
|
|
if (token) {
|
|
xhr.setRequestHeader("Authorization", token);
|
|
}
|
|
|
|
var params = JSON.stringify(data);
|
|
xhr.send();
|
|
|
|
xhr.onreadystatechange = () => {
|
|
if (xhr.readyState == 4 && xhr.status == 200) {
|
|
var res = JSON.parse(xhr.responseText);
|
|
callback(res);
|
|
}
|
|
};
|
|
}
|
|
|
|
});
|
|
|
|
_cclegacy._RF.pop();
|
|
|
|
_crd = false;
|
|
}
|
|
};
|
|
});
|
|
//# sourceMappingURL=557b9edcc2b4077c8e398790ca34c5a43c5e6006.js.map
|