'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getFeatures = undefined;

var _Fetcher = require('../util/Fetcher');

var _Fetcher2 = _interopRequireDefault(_Fetcher);

var _features = require('../actions/features');

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

var getFeatures = exports.getFeatures = function getFeatures() {
  var url = '/api/features';
  return function (dispatch, getState) {
    var fetcher = new _Fetcher2.default();

    var addFeaturesToStore = function addFeaturesToStore(featuresList) {
      dispatch((0, _features.addFeatures)(featuresList));
    };

    return fetcher.get(url).then(addFeaturesToStore);
  };
};