Skip to content

Instantly share code, notes, and snippets.

@jponc
Created July 22, 2017 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jponc/21c999987b5c35ef5d8d4718e9b4193e to your computer and use it in GitHub Desktop.
Save jponc/21c999987b5c35ef5d8d4718e9b4193e to your computer and use it in GitHub Desktop.
Can't identify userLogin action :(
import React, { Component } from 'react'
import { Field, reduxForm } from 'redux-form'
import { userLogin } from '../../actions'
import './index.css'
class Login extends Component {
componentWillMount (){
document.body.classList.add('login');
}
componentWillUnmount (){
document.body.classList.remove('login');
}
onSubmit(props) {
debugger
this.props.userLogin // This is undefined apparently :/
}
render() {
const { handleSubmit } = this.props
return (
<div>
<div className="logo">
<a href="index.html">
<img src="../assets/pages/img/logo-big.png" alt="logo"/>
</a>
</div>
<div className="content">
<form className="login-form" onSubmit={handleSubmit(this.onSubmit.bind(this))}>
<h3 className="form-title font-green">Sign In</h3>
<div className="alert alert-danger display-hide">
<button className="close" data-close="alert" />
<span> Enter any username and password. </span>
</div>
<div className="form-group">
{/*ie8, ie9 does not support html5 placeholder, so we just show field title for that*/}
<label className="control-label visible-ie8 visible-ie9">Username</label>
<Field
name="username"
component="input"
type="text"
placeholder="Username"
autoComplete="off"
className="form-control form-control-solid placeholder-no-fix"
/>
</div>
<div className="form-group">
<label className="control-label visible-ie8 visible-ie9">Password</label>
<Field
name="password"
component="input"
type="password"
placeholder="Password"
autoComplete="off"
className="form-control form-control-solid placeholder-no-fix"
/>
</div>
<div className="form-actions">
<button type="submit" className="btn green uppercase">Login</button>
<label className="rememberme check mt-checkbox mt-checkbox-outline">
<input type="checkbox" name="remember" defaultValue={1} />Remember
<span />
</label>
<a href="/forgot_password" id="forget-password" className="forget-password">Forgot Password?</a>
</div>
<div className="create-account">
<p>
<a href="/register" id="register-btn" className="uppercase">Create an account</a>
</p>
</div>
</form>
<div className="copyright"> 2014 © Metronic. Admin Dashboard Template. </div>
</div>
</div>
)
}
}
export default reduxForm({
form: 'kamote'
}, null, { userLogin })(Login)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment