@@ -9,15 +9,15 @@ class LoginForm extends Component {
9
9
super ( props ) ;
10
10
this . state = {
11
11
identifier : '' ,
12
- password :'' ,
12
+ password : '' ,
13
13
errors : { } ,
14
14
isLoading : false ,
15
15
} ;
16
16
this . onSubmit = this . onSubmit . bind ( this )
17
17
this . onChange = this . onChange . bind ( this )
18
18
}
19
19
20
- isValid ( ) {
20
+ isValid ( ) {
21
21
const { errors, isValid } = validateInput ( this . state ) ;
22
22
if ( ! isValid ) {
23
23
this . setState ( { errors } )
@@ -30,11 +30,11 @@ class LoginForm extends Component {
30
30
if ( this . isValid ( ) ) {
31
31
this . setState ( { errors : { } , isLoading : true } )
32
32
this . props . login ( this . state ) . then (
33
- ( res ) => {
34
- this . context . router . history . push ( '/matchmaker' ) ;
35
- window . location . reload ( ) ;
36
- } ,
37
- ( err ) => this . setState ( { errors : err . data . errors , isLoading : false } )
33
+ ( res ) => {
34
+ this . context . router . history . push ( '/matchmaker' ) ;
35
+ window . location . reload ( ) ;
36
+ } ,
37
+ ( err ) => this . setState ( { errors : err . data . errors , isLoading : false } )
38
38
) ;
39
39
}
40
40
}
@@ -43,41 +43,41 @@ class LoginForm extends Component {
43
43
this . setState ( { [ e . target . name ] : e . target . value } ) ;
44
44
}
45
45
46
- render ( ) {
46
+ render ( ) {
47
47
const { errors, identifier, password, isLoading } = this . state ;
48
48
return (
49
49
< div id = "page-top" className = "page-top" data-spy = "scroll" data-target = ".navbar-custom" >
50
-
51
- < section id = "login" className = "login" >
52
- < div >
53
- < video autoPlay loop muted src = "/loginVid.mp4" />
54
- </ div >
50
+
51
+ < section id = "login" className = "login" >
52
+ < div >
53
+ < video autoPlay loop muted src = "/loginVid.mp4" />
54
+ </ div >
55
55
< div className = "formdiv" >
56
56
< form onSubmit = { this . onSubmit } >
57
57
< h1 > Account Login</ h1 >
58
58
59
- { errors . form && < div className = "alert alert-danger" > { errors . form } </ div > }
60
-
61
- < TextFieldGroup
62
- field = "identifier"
63
- label = "Username / Email"
64
- value = { this . state . identifier }
65
- error = { errors . identifier }
66
- onChange = { this . onChange } />
59
+ { errors . form && < div className = "alert alert-danger" > { errors . form } </ div > }
60
+
61
+ < TextFieldGroup
62
+ field = "identifier"
63
+ label = "Username / Email"
64
+ value = { this . state . identifier }
65
+ error = { errors . identifier }
66
+ onChange = { this . onChange } />
67
67
68
- < TextFieldGroup
69
- field = "password"
70
- label = "Password"
71
- value = { this . state . password }
72
- error = { errors . password }
73
- onChange = { this . onChange }
74
- type = "password" />
68
+ < TextFieldGroup
69
+ field = "password"
70
+ label = "Password"
71
+ value = { this . state . password }
72
+ error = { errors . password }
73
+ onChange = { this . onChange }
74
+ type = "password" />
75
75
76
- < div className = "form-group" > < button className = "btn btn-primary btn-lg" disabled = { isLoading } > Login</ button > </ div >
76
+ < div className = "form-group" > < button className = "btn btn-primary btn-lg" disabled = { isLoading } > Login</ button > </ div >
77
77
</ form >
78
78
</ div >
79
79
</ section >
80
- </ div >
80
+ </ div >
81
81
) ;
82
82
}
83
83
}
0 commit comments