@@ -18,9 +18,9 @@ import { makeStyles } from '@material-ui/core/styles'
18
18
import LockOutlinedIcon from '@material-ui/icons/LockOutlined'
19
19
import Visibility from '@material-ui/icons/Visibility'
20
20
import VisibilityOff from '@material-ui/icons/VisibilityOff'
21
- import { Link as RouterLink , useHistory } from 'react-router-dom'
21
+ import { Link as RouterLink } from 'react-router-dom'
22
22
import { useSelector , useDispatch } from 'react-redux'
23
- import { signUp , authDefault , googleLogin } from '../redux/slices/authSlice'
23
+ import { signUp , authDefault , googleLogin , githubLogin } from '../redux/slices/authSlice'
24
24
import google from '../static/google.png'
25
25
import github from '../static/github-mark.png'
26
26
@@ -48,7 +48,8 @@ const useStyles = makeStyles((theme) => ({
48
48
export default function SignUp ( ) {
49
49
const classes = useStyles ( )
50
50
51
- const auth = useSelector ( state => state . auth )
51
+ const isRegistered = useSelector ( state => state . auth . isRegistered )
52
+ const regErrors = useSelector ( state => state . auth . regErrors )
52
53
53
54
const dispatch = useDispatch ( )
54
55
const homeURL = `${ window . location . protocol } \\\\${ window . location . host } /`
@@ -58,8 +59,6 @@ export default function SignUp () {
58
59
document . title = 'Sign Up - ' + process . env . REACT_APP_NAME
59
60
} , [ dispatch ] )
60
61
61
- const history = useHistory ( )
62
-
63
62
const [ email , setEmail ] = useState ( '' )
64
63
const [ password , setPassword ] = useState ( '' )
65
64
const [ reenterPassword , setReenterPassword ] = useState ( '' )
@@ -80,7 +79,7 @@ export default function SignUp () {
80
79
// Function call for github sign up.
81
80
const handleGithubLogin = ( ) => {
82
81
const host = window . location . origin
83
- const toUrl = '' // Add any redirect URL logic if needed
82
+ const toUrl = ''
84
83
dispatch ( githubLogin ( host , toUrl ) )
85
84
}
86
85
@@ -96,8 +95,8 @@ export default function SignUp () {
96
95
</ Typography >
97
96
98
97
{ /* Display's error messages while signing in */ }
99
- < Typography variant = 'body1' align = 'center' style = { { marginTop : '10px' } } color = { auth . isRegistered ? 'secondary' : 'error' } >
100
- { auth . regErrors }
98
+ < Typography variant = 'body1' align = 'center' style = { { marginTop : '10px' } } color = { isRegistered ? 'secondary' : 'error' } >
99
+ { regErrors }
101
100
</ Typography >
102
101
103
102
< form className = { classes . form } noValidate >
@@ -177,7 +176,7 @@ export default function SignUp () {
177
176
fullWidth
178
177
variant = 'contained'
179
178
color = 'primary'
180
- onClick = { ( ) => dispatch ( signUp ( email , password , reenterPassword , history ) ) }
179
+ onClick = { ( ) => dispatch ( signUp ( { email, password, reenterPassword } ) ) }
181
180
className = { classes . submit }
182
181
disabled = { ! accept }
183
182
>
0 commit comments