t-comm
Version:
专业、稳定、纯粹的工具库
37 lines (33 loc) • 779 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
/**
* 获取rtx信息
* @private
* @example
* ```ts
* getRtxInfo().then((info) => {
* console.log(info); // { rtx: 'xxx', ... }
* });
* ```
*/
function getRtxInfo() {
return new Promise(function (resolve, reject) {
var cached = localStorage.getItem('AEGIS_RTX');
if (cached) {
resolve(cached);
return;
}
var url = "".concat(location.origin, "/ts:auth/tauth/info.ashx");
fetch(url).then(function (response) {
if (response.status === 200) {
return response.json();
}
return {};
}).then(function (data) {
resolve(data);
})["catch"](function (err) {
reject(err);
});
});
}
exports.getRtxInfo = getRtxInfo;