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'
|
2016-06-22 19:58:23 +00:00
|
|
|
import * as UserActions from '../actions'
|
2016-06-22 17:49:06 +00:00
|
|
|
import LoginForm from '../components/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);
|