@@ -15,59 +15,57 @@ class LoginComponent extends React.Component{
1515 this . refs . username . value ,
1616 this . refs . password . value
1717 ) . then ( ( response ) => {
18- localStorage . token = response . data . token ;
19- window . location . href = "/" ;
18+ if ( response . data . success == 200 ) {
19+ localStorage . token = response . data . token ;
20+ window . location . href = "/" ;
21+ }
2022 } ) ;
21- console . log ( this . refs . username . value ) ;
22- console . log ( this . refs . password . value ) ;
2323 }
2424
2525 render ( ) {
2626 return (
27- < section className = "hero is-fullheight is-primary" >
28- < div className = "hero-body" >
29- < div className = "container" >
30- < div className = "columns is-vcentered" >
31- < div className = "column is-4 is-offset-4" >
32- < h1 className = "title has-text-centered" >
33- IClient
34- </ h1 >
35- < form onSubmit = { this . handleSubmit } >
36- < div className = "box" >
37- < label className = "label" > Username</ label >
38- < p className = "control" >
39- < input
40- ref = 'username'
41- className = "input"
42- type = "text"
43- placeholder = "Ex: jsmith"
44- />
45- </ p >
46- < label className = "label" > Password</ label >
47- < p className = "control" >
48- < input
49- ref = 'password'
50- className = "input"
51- type = "password"
52- placeholder = "●●●●●●●"
53- />
54- </ p >
55- < hr />
56- < p className = "control" >
57- < button className = "button is-primary" > Login</ button >
58- </ p >
59- < p className = "has-text-centered" >
60- < a href = "register.html" > Register an Account</ a >
61- |
62- < a href = "#" > Forgot password</ a >
63- </ p >
64- </ div >
65- </ form >
66- </ div >
27+ < div className = "hero-body" >
28+ < div className = "container" >
29+ < div className = "columns is-vcentered" >
30+ < div className = "column is-4 is-offset-4" >
31+ < h1 className = "title has-text-centered" >
32+ IClient
33+ </ h1 >
34+ < form onSubmit = { this . handleSubmit } >
35+ < div className = "box" >
36+ < label className = "label" > Username</ label >
37+ < p className = "control" >
38+ < input
39+ ref = 'username'
40+ className = "input"
41+ type = "text"
42+ placeholder = "Ex: jsmith"
43+ />
44+ </ p >
45+ < label className = "label" > Password</ label >
46+ < p className = "control" >
47+ < input
48+ ref = 'password'
49+ className = "input"
50+ type = "password"
51+ placeholder = "●●●●●●●"
52+ />
53+ </ p >
54+ < hr />
55+ < p className = "control" >
56+ < button className = "button is-primary" > Login</ button >
57+ </ p >
58+ < p className = "has-text-centered" >
59+ < a href = "register.html" > Register an Account</ a >
60+ |
61+ < a href = "#" > Forgot password</ a >
62+ </ p >
63+ </ div >
64+ </ form >
6765 </ div >
6866 </ div >
6967 </ div >
70- </ section >
68+ </ div >
7169 ) ;
7270 }
7371}
0 commit comments