2016-05-24 05:20:59 +00:00
|
|
|
import React from 'react'
|
2016-06-14 20:48:16 +00:00
|
|
|
import { bindActionCreators } from 'redux'
|
|
|
|
import {reduxForm} from 'redux-form'
|
|
|
|
import * as UserActions from '../../redux/actions/user'
|
|
|
|
import LoginForm from '../../components/LoginForm/LoginForm'
|
2016-05-24 05:20:59 +00:00
|
|
|
|
|
|
|
class LoginView extends React.Component {
|
|
|
|
render() {
|
|
|
|
return (
|
2016-06-14 20:48:16 +00:00
|
|
|
<div className="login">
|
|
|
|
<h1>Login</h1>
|
|
|
|
<LoginForm {...this.props} />
|
|
|
|
</div>
|
2016-05-24 05:20:59 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-14 20:48:16 +00:00
|
|
|
function mapStateToProps(state) {
|
|
|
|
return {
|
|
|
|
user: state.user
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function mapDispatchToProps(dispatch) {
|
|
|
|
return bindActionCreators(UserActions, dispatch);
|
|
|
|
}
|
|
|
|
|
|
|
|
function validate(formProps) {
|
|
|
|
const errors = {};
|
|
|
|
return errors;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default reduxForm({
|
|
|
|
form: 'login',
|
|
|
|
fields: ['email', 'password'],
|
|
|
|
validate
|
|
|
|
}, mapStateToProps, mapDispatchToProps)(LoginView);
|