@@ -5,7 +5,7 @@ import { signUp } from './SignUpAPI';
55import { setAuthStatus } from '../../redux/actions/AuthActions' ;
66
77export class SignUpForm extends Component {
8- constructor ( props ) {
8+ constructor ( props ) {
99 super ( props ) ;
1010 this . state = {
1111 username : '' ,
@@ -21,7 +21,7 @@ export class SignUpForm extends Component {
2121 * SignUp process.
2222 */
2323
24- performSignUp ( ) {
24+ performSignUp ( ) {
2525 signUp ( this . state . username , this . state . password , this . props . setAuthStatus ) ;
2626 }
2727
@@ -30,26 +30,22 @@ export class SignUpForm extends Component {
3030 * Forms event handling.
3131 */
3232
33- handleUsernameChange ( event ) {
34- this . setState ( { username : event . target . value } ) ;
33+ handleUsernameChange ( event ) {
34+ this . setState ( { username : event . target . value } ) ;
3535 }
3636
37- handlePasswordChange ( event ) {
38- this . setState ( { password : event . target . value } ) ;
37+ handlePasswordChange ( event ) {
38+ this . setState ( { password : event . target . value } ) ;
3939 }
4040
41- render ( ) {
42- return (
43- < form className = "form-size" >
44- < div className = "form-group" >
45- < label > Username</ label >
46- < input type = "text" className = "form-control" value = { this . state . username } onChange = { this . handleUsernameChange } />
47- < label > Password</ label >
48- < input type = "password" className = "form-control" value = { this . state . password } onChange = { this . handlePasswordChange } />
49- < br />
50- < button type = "button" className = "btn btn-secondary" onClick = { this . performSignUp } > SignUp</ button >
51- </ div >
52- </ form >
41+ render ( ) {
42+ return (
43+ < div >
44+ < label > Username</ label >
45+ < input type = "text" className = "form-control" value = { this . state . username } onChange = { this . handleUsernameChange } />
46+ < label > Password</ label >
47+ < input type = "password" className = "form-control" value = { this . state . password } onChange = { this . handlePasswordChange } />
48+ </ div >
5349 )
5450 }
5551}
@@ -58,12 +54,8 @@ SignUpForm.propTypes = {
5854 setAuthStatus : PropTypes . func
5955}
6056
61- const mapStateToProps = ( state ) => ( {
62-
63- } )
64-
6557const mapDispatchToProps = {
6658 setAuthStatus
6759}
6860
69- export default connect ( mapStateToProps , mapDispatchToProps ) ( SignUpForm )
61+ export default connect ( null , mapDispatchToProps , null , { withRef : true } ) ( SignUpForm )
0 commit comments