-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathSignInForm.js
More file actions
38 lines (31 loc) · 1.02 KB
/
SignInForm.js
File metadata and controls
38 lines (31 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React, { Component } from 'react'
import {reduxForm, Field} from 'redux-form'
import PropTypes from "prop-types"
class SignInForm extends Component {
static propTypes = {
authError: PropTypes.object,
authLoading: PropTypes.bool.isRequired
};
render() {
const {authError, authLoading} = this.props;
return (
<div>
<h3>Sign In</h3>
<form onSubmit={this.props.handleSubmit}>
<div>
email: <Field name='email' component='input'/>
</div>
<div>
password: <Field name='password' component='input' type='password'/>
</div>
{authLoading && <p>Loading...</p>}
{authError && <p style={{color: 'red'}}>{authError.message}</p>}
<input type='submit' />
</form>
</div>
)
}
}
export default reduxForm({
form: 'auth'
})(SignInForm)