"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const config = require("./config.js");
require("../../../_virtual/FileSaver.min.js");
const util = require("./util.js");
function get(url, showLoading = true) {
  return new Promise((resolve, reject) => {
    util.paramHandler(null, showLoading);
    config.default.get(url).then((res) => {
      util.successRollback(resolve, res);
    }).catch((err) => {
      util.errRollback(reject, err);
    });
  });
}
function post(url, params, showLoading = true) {
  return new Promise((resolve, reject) => {
    params = util.paramHandler(params, showLoading);
    config.default.post(url, params).then((res) => {
      util.successRollback(resolve, res);
    }).catch((err) => {
      util.errRollback(reject, err);
    });
  });
}
function postForm(url, params, showLoading = true, isUpload = false) {
  return new Promise((resolve, reject) => {
    params = util.paramHandler(params, showLoading, isUpload);
    config.default.postForm(url, params, { headers: { isUpload } }).then((res) => {
      util.successRollback(resolve, res);
    }).catch((err) => {
      util.errRollback(reject, err);
    });
  });
}
exports.get = get;
exports.post = post;
exports.postForm = postForm;
