diff options
Diffstat (limited to 'src/pages')
-rw-r--r-- | src/pages/AuthPage/AuthPage.tsx | 7 | ||||
-rw-r--r-- | src/pages/AuthPage/SignInForm.tsx | 6 | ||||
-rw-r--r-- | src/pages/AuthPage/SignUpForm.tsx | 6 |
3 files changed, 9 insertions, 10 deletions
diff --git a/src/pages/AuthPage/AuthPage.tsx b/src/pages/AuthPage/AuthPage.tsx index fc7f404..0072686 100644 --- a/src/pages/AuthPage/AuthPage.tsx +++ b/src/pages/AuthPage/AuthPage.tsx @@ -1,7 +1,6 @@ import React, { useState } from 'react'; import SignInForm from './SignInForm'; import SignUpForm from './SignUpForm'; -import { Authorization } from '../../types'; interface PropTypes { @@ -9,12 +8,12 @@ interface PropTypes { } const AuthPage: React.FC<PropTypes> = ({ logIn }) => { - const [authorization, setAuthorization] = useState<Authorization>({ authorize: 'signIn' }); + const [auth, setAuth] = useState<String>('signIn'); return ( <> - {authorization.authorize === 'signIn' && <SignInForm logIn={logIn} setAuthorization={setAuthorization} />} - {authorization.authorize === 'signUp' && <SignUpForm logIn={logIn} setAuthorization={setAuthorization} />} + {auth === 'signIn' && <SignInForm logIn={logIn} setAuth={setAuth} />} + {auth === 'signUp' && <SignUpForm logIn={logIn} setAuth={setAuth} />} </> ); }; diff --git a/src/pages/AuthPage/SignInForm.tsx b/src/pages/AuthPage/SignInForm.tsx index cf68493..ae75541 100644 --- a/src/pages/AuthPage/SignInForm.tsx +++ b/src/pages/AuthPage/SignInForm.tsx @@ -5,7 +5,7 @@ import Button from '@material-ui/core/Button'; interface PropTypes { logIn: (name: string, password: string) => Promise<boolean>; - setAuthorization: (authorization: { authorize: string }) => void; + setAuth: (auth: string) => void; } const useStyles = makeStyles(theme => ({ @@ -33,7 +33,7 @@ const useStyles = makeStyles(theme => ({ } })); -const SignInForm: React.FC<PropTypes> = ({ logIn, setAuthorization }) => { +const SignInForm: React.FC<PropTypes> = ({ logIn, setAuth }) => { const [error, setError] = useState<boolean>(false); const classes = useStyles(); const nameRef = useRef<HTMLInputElement>(); @@ -50,7 +50,7 @@ const SignInForm: React.FC<PropTypes> = ({ logIn, setAuthorization }) => { }; const handleSignUp = () => { - setAuthorization({ authorize: 'signUp' }); + setAuth('signUp'); }; return ( diff --git a/src/pages/AuthPage/SignUpForm.tsx b/src/pages/AuthPage/SignUpForm.tsx index a4271d5..0013372 100644 --- a/src/pages/AuthPage/SignUpForm.tsx +++ b/src/pages/AuthPage/SignUpForm.tsx @@ -6,7 +6,7 @@ import { post } from '../../requests'; interface PropTypes { logIn: (name: string, password: string) => Promise<boolean>; - setAuthorization: (authorization: { authorize: string }) => void ; + setAuth: (auth: string) => void ; } const useStyles = makeStyles(theme => ({ @@ -34,7 +34,7 @@ const useStyles = makeStyles(theme => ({ } })); -const SignUpForm: React.FC<PropTypes> = ({ logIn, setAuthorization }) => { +const SignUpForm: React.FC<PropTypes> = ({ logIn, setAuth }) => { const classes = useStyles(); const inputRef = useRef<HTMLInputElement>(); const inputRefPassword = useRef<HTMLInputElement>(); @@ -52,7 +52,7 @@ const SignUpForm: React.FC<PropTypes> = ({ logIn, setAuthorization }) => { }; const handleSignIn = () => { - setAuthorization({ authorize: 'signIn' }); + setAuth( 'signIn'); }; return ( |