@@ -21,12 +21,12 @@ const LOGIN_MUTATION = gql`
21
21
` ;
22
22
23
23
const Login = props => {
24
- const [ login , setLogin ] = React . useState ( true ) ;
24
+ const [ isLogin , setLogin ] = React . useState ( true ) ;
25
25
const [ email , setEmail ] = React . useState ( '' ) ;
26
26
const [ password , setPassword ] = React . useState ( '' ) ;
27
27
const [ name , setName ] = React . useState ( '' ) ;
28
28
29
- const [ state , executeMutation ] = useMutation (
29
+ const [ { fetching } , executeMutation ] = useMutation (
30
30
isLogin ? LOGIN_MUTATION : SIGNUP_MUTATION
31
31
) ;
32
32
@@ -39,13 +39,13 @@ const Login = props => {
39
39
props . history . push ( '/' )
40
40
}
41
41
} ) ;
42
- } , [ executeMutation , props . history , setToken , email , password , name ] ) ;
42
+ } , [ executeMutation , props . history , email , password , name , isLogin ] ) ;
43
43
44
44
return (
45
45
< div >
46
- < h4 className = "mv3" > { login ? ' Login' : ' Sign Up' } </ h4 >
46
+ < h4 className = "mv3" > { isLogin ? " Login" : " Sign Up" } </ h4 >
47
47
< div className = "flex flex-column" >
48
- { ! login && (
48
+ { ! isLogin && (
49
49
< input
50
50
value = { name }
51
51
onChange = { e => setName ( e . target . value ) }
@@ -73,14 +73,14 @@ const Login = props => {
73
73
onClick = { mutate }
74
74
disabled = { fetching }
75
75
>
76
- { login ? ' login' : ' create account' }
76
+ { isLogin ? " login" : " create account" }
77
77
</ button >
78
78
< button
79
79
type = "button"
80
80
className = "pointer button"
81
- onClick = { ( ) => setLogin ( ! login ) }
81
+ onClick = { ( ) => setLogin ( ! isLogin ) }
82
82
>
83
- { login ? ' need to create an account?' : ' already have an account?' }
83
+ { isLogin ? " need to create an account?" : " already have an account?" }
84
84
</ button >
85
85
</ div >
86
86
</ div >
0 commit comments