diff options
Diffstat (limited to 'src/pages/AuthPage/AuthPage.tsx')
-rw-r--r-- | src/pages/AuthPage/AuthPage.tsx | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/src/pages/AuthPage/AuthPage.tsx b/src/pages/AuthPage/AuthPage.tsx index 9b8040c..c490078 100644 --- a/src/pages/AuthPage/AuthPage.tsx +++ b/src/pages/AuthPage/AuthPage.tsx @@ -1,8 +1,8 @@ import React, {useState} from 'react'; -import { Authorization} from '../../types'; +import {Authorization} from '../../types'; import SignInForm from './SignInForm'; import {makeStyles} from "@material-ui/core"; -import Registration from "./Registration"; +import SignUpForm from "./SignUpForm"; interface PropTypes { logIn: (name: string, password: string) => Promise<boolean>; @@ -19,28 +19,13 @@ const useStyles = makeStyles(theme => ({ const AuthPage: React.FC<PropTypes> = ({logIn}) => { const classes = useStyles(); - const[authorization,setAuthorization] = useState<Authorization>({authorize: 'signUp'}); - - const handleSignUp = () => { - setAuthorization({authorize: 'signUp'}); - console.log(authorization.authorize); - }; - - const handleRegistration = () => { - setAuthorization({authorize: 'registration'}); - console.log(authorization.authorize); - }; + const [authorization, setAuthorization] = useState<Authorization>({authorize: 'signIn'}); return ( <> - <div className={classes.authorize}> - <div onClick={handleSignUp}>SignUp</div> - <div>or</div> - <div onClick={handleRegistration}>Registrate</div> - </div> - { authorization.authorize === 'signUp' && <SignInForm logIn={logIn} /> } - { authorization.authorize === 'registration' && <Registration logIn={logIn} /> } - </> + {authorization.authorize === 'signIn' && <SignInForm logIn={logIn} setAuthorization={setAuthorization}/>} + {authorization.authorize === 'signUp' && <SignUpForm logIn={logIn} setAuthorization={setAuthorization} />} + </> ); }; |