"use strict";

var _axios = require("axios");

var _axios2 = _interopRequireDefault(_axios);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }

var call = function () {
    var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
        var method = _ref.method,
            data = _ref.data,
            header = _ref.header,
            url = _ref.url;
        var optons;
        return regeneratorRuntime.wrap(function _callee$(_context) {
            while (1) {
                switch (_context.prev = _context.next) {
                    case 0:
                        optons = {
                            method: method ? method : "GET",
                            data: data ? data : null,
                            header: header ? header : null
                        };
                        _context.next = 3;
                        return (0, _axios2.default)(url, optons);

                    case 3:
                        return _context.abrupt("return", _context.sent);

                    case 4:
                    case "end":
                        return _context.stop();
                }
            }
        }, _callee, undefined);
    }));

    return function call(_x) {
        return _ref2.apply(this, arguments);
    };
}();
// static  seriesFun=async (data)=>{

//     data.map((params)=> {
//         this.apiAxios();
//     })
//   }
//   static    parallelFun=async ()=>{

//   }


module.exports = {
    _callApi: call
};