Liferay.Loader.define("portal-workflow-metrics-web@2.0.46/js/shared/rest/fetch.es", ['module', 'exports', 'require', 'portal-workflow-metrics-web$axios', 'portal-workflow-metrics-web$qs'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = exports.getClient = void 0;

    var _axios = _interopRequireDefault(require("portal-workflow-metrics-web$axios"));

    var _qs = _interopRequireDefault(require("portal-workflow-metrics-web$qs"));

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

    function _defineProperty(obj, key, value) {
      if (key in obj) {
        Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });
      } else {
        obj[key] = value;
      }return obj;
    }

    /**
     * @module fetch
     * @description Basic alias of fetch client to perform consults in portal rest API.
     * @example
     * import fetch from '@/shared/rest/fetch';
     * fetch.get('/process').then(res => console.log(res));
     */
    _axios.default.defaults.headers.common['Accept-Language'] = Liferay.ThemeDisplay.getBCP47LanguageId();
    _axios.default.defaults.params = _defineProperty({}, 'p_auth', Liferay.authToken);

    _axios.default.defaults.paramsSerializer = function (params) {
      return _qs.default.stringify(params, {
        arrayFormat: 'repeat'
      });
    };

    var adminClient = _axios.default.create({
      baseURL: '/o/headless-admin-workflow/v1.0'
    });

    var metricsClient = _axios.default.create({
      baseURL: '/o/portal-workflow-metrics/v1.0'
    });

    var getClient = function getClient(admin) {
      return admin ? adminClient : metricsClient;
    };

    exports.getClient = getClient;
    var _default = metricsClient;
    exports.default = _default;
    //# sourceMappingURL=fetch.es.js.map
  }
});
//# sourceMappingURL=fetch.es.js.map