import { connect } from 'react-redux';
import { arrayPush, reduxForm, getFormValues, change } from 'redux-form';
import { withRouter } from 'react-router-dom';
import app from 'store/app';
import ModuleForm from './ModuleForm';

// const createReduxForm = reduxForm({
//   // a unique name for the form
//   form: 'moduleForm',
//   enableReinitialize: true,
// });

// const form = createReduxForm(ModuleForm);

const mapStateToProps = state => ({
  content: state.content.raw,
  loading: state.generic.loading,
  formValues: getFormValues('moduleForm')(state),
});

const mapDispatchToProps = {
  push: arrayPush,
};

const Wrapped = connect(mapStateToProps, mapDispatchToProps)(ModuleForm);

export default withRouter(Wrapped);
