2016-06-09 02:52:59 +02:00
|
|
|
import React from 'react'
|
2016-06-09 22:28:21 +02:00
|
|
|
import { bindActionCreators } from 'redux'
|
|
|
|
import { connect } from 'react-redux'
|
2016-06-22 21:58:23 +02:00
|
|
|
import * as UserActions from '../actions'
|
2016-06-09 22:28:21 +02:00
|
|
|
import { reduxForm } from 'redux-form'
|
2016-06-22 19:49:06 +02:00
|
|
|
import SignupForm from '../components/SignupForm'
|
2016-06-09 02:52:59 +02:00
|
|
|
|
|
|
|
class SignupView extends React.Component {
|
|
|
|
render() {
|
|
|
|
return (
|
2016-06-14 03:07:00 +02:00
|
|
|
<div className="signup">
|
|
|
|
<h1>Sign Up</h1>
|
|
|
|
<SignupForm {...this.props} />
|
|
|
|
</div>
|
2016-06-09 02:52:59 +02:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-09 22:28:21 +02:00
|
|
|
function mapStateToProps(state) {
|
|
|
|
return {
|
|
|
|
user: state.user
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function mapDispatchToProps(dispatch) {
|
|
|
|
return bindActionCreators(UserActions, dispatch);
|
|
|
|
}
|
|
|
|
|
|
|
|
function validate(formProps) {
|
|
|
|
const errors = {};
|
|
|
|
return errors;
|
|
|
|
}
|
|
|
|
|
|
|
|
// export default connect(mapStateToProps, mapDispatchToProps)(SignupView);
|
|
|
|
export default reduxForm({
|
|
|
|
form: 'signup',
|
|
|
|
fields: ['username', 'email', 'password', 'passwordConfirm'],
|
|
|
|
validate
|
|
|
|
}, mapStateToProps, mapDispatchToProps)(SignupView);
|