'use strict';

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

var _reactRedux = require('react-redux');

var _withConfig = require('../../enhancers/withConfig');

var _withConfig2 = _interopRequireDefault(_withConfig);

var _RecordPage = require('../../components/pages/RecordPage');

var _RecordPage2 = _interopRequireDefault(_RecordPage);

var _record = require('../../actions/record');

var _reducers = require('../../reducers');

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

var mapStateToProps = function mapStateToProps(state, ownProps) {
  var _getParams = (0, _RecordPage.getParams)(ownProps),
      csid = _getParams.csid;

  return {
    data: (0, _reducers.getRecordData)(state, csid),
    error: (0, _reducers.getRecordError)(state, csid),
    perms: (0, _reducers.getUserPerms)(state)
  };
};

var mapDispatchToProps = {
  readRecord: _record.readRecord
};

var ConnectedRecordPage = exports.ConnectedRecordPage = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_RecordPage2.default);

exports.default = (0, _withConfig2.default)(ConnectedRecordPage);