"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _axios = _interopRequireDefault(require("axios"));

var jsonMimeType = 'application/json';

var instance = _axios["default"].create({
  timeout: 30000,
  headers: {
    'Content-Type': jsonMimeType,
    Accept: jsonMimeType,
    'X-Requested-With': 'XMLHttpRequest'
  }
}); // http response 拦截器


instance.interceptors.response.use(function (response) {
  var status = response.status,
      data = response.data;

  if (status === 204) {
    return response;
  }

  if (data.success === false) {
    throw data;
  } else {
    return data;
  }
});
var _default = instance;
exports["default"] = _default;
//# sourceMappingURL=index.js.map
