content: import React from 'react';
  import {browserHistory} from 'react-router';
  import _ from 'lodash';
  import formIsComplete from 'utility/formIsComplete';
  import AddConfigForm from 'components/Forms/AddConfigForm';
  import './add-config.less';
  
  class AddConfig extends React.Component {
    constructor(...args) {
      super(...args);
      this.state = {
        form: new AddConfigForm({
          onChange: (e) => {
            this.forceUpdate();
          },
          controlled: true,
          initial: {distribution_platform: 'encompass'}
        })
      };
    }
  
    render() {
      const error = this.state.error;
      const isValid = formIsComplete(this.state.form);
      return (
        <div className="add-config-wrapper card">
           <h2 className="card-title">Connect A Report</h2>
          <form onSubmit={this.onSubmit.bind(this)} className={isValid ? 'valid' : ''}>
            {this.state.form.render(this.props, this.state, error)}
          </form>
        </div>
      );
    }
  
    async onSubmit(e) {
      e.preventDefault();
      const form = this.state.form;
      if (form.validate()) {
        const data = form.cleanedData;
        this.setState({loading: true});
        const config = await this.props.submitConfig(data, this.props.membership.membership_id, this.props.redirect ? 'redirect' : '');
        this.setState({loading: false});
        if (config) {
          if (this.props.hideForm) {
            this.props.hideForm();
          }
        } else {
          this.setState({error: 'There was an error'});
        }
      }
    }
  
    
  }
  
  AddConfig.propTypes = {
  };
  
  export default AddConfig;