codess
Version:
vscode代码片段管理器,通过 本地包(本地某个文件夹) 或官网的 远程包(代码片段集合) 生成本地项目的 vscode 代码片段配置。
43 lines (42 loc) • 1.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.API = void 0;
const request_1 = require("../utils/request");
const JSONPar_1 = require("../yayaluoya-tool/JSONPar");
const env_1 = require("../env");
class API {
static get op() {
return {
baseURL: env_1.ENV.baseURL,
};
}
static request(op, progress) {
return (0, request_1.request)(Object.assign(Object.assign({}, this.op), op), progress)
.then((res) => {
return (0, JSONPar_1.JSONPar)(res, {
status: 400,
msg: 'Error',
data: null,
});
})
.then((res) => {
if (res.status != 200) {
throw res.msg;
}
return res.data;
});
}
static get(op, progress) {
return this.request(Object.assign({ method: 'get' }, op), progress);
}
static post(op, progress) {
return this.request(Object.assign({ method: 'post' }, op), progress);
}
static delete(op, progress) {
return this.request(Object.assign({ method: 'delete' }, op), progress);
}
static put(op, progress) {
return this.request(Object.assign({ method: 'put' }, op), progress);
}
}
exports.API = API;