diff options
Diffstat (limited to 'src/pages/AuthPage')
-rw-r--r-- | src/pages/AuthPage/AuthPage.tsx | 5 | ||||
-rw-r--r-- | src/pages/AuthPage/SignInForm.tsx | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/pages/AuthPage/AuthPage.tsx b/src/pages/AuthPage/AuthPage.tsx index d9c43d3..82d468d 100644 --- a/src/pages/AuthPage/AuthPage.tsx +++ b/src/pages/AuthPage/AuthPage.tsx @@ -4,10 +4,11 @@ import SignInForm from './SignInForm'; interface PropTypes { setUser: (newUser: User | undefined) => void; + navigate: (prefix: string, id: string) => void; } -const AuthPage: React.FC<PropTypes> = ({ setUser }) => { - return <SignInForm setUser={setUser} />; +const AuthPage: React.FC<PropTypes> = ({ setUser, navigate }) => { + return <SignInForm setUser={setUser} navigate={navigate} />; }; export default AuthPage; diff --git a/src/pages/AuthPage/SignInForm.tsx b/src/pages/AuthPage/SignInForm.tsx index 6e27535..b7696e7 100644 --- a/src/pages/AuthPage/SignInForm.tsx +++ b/src/pages/AuthPage/SignInForm.tsx @@ -7,6 +7,7 @@ import { get } from '../../requests'; interface PropTypes { setUser: (newUser: User) => void; + navigate: (prefix: string, id: string) => void; } const useStyles = makeStyles(theme => ({ @@ -22,7 +23,7 @@ const useStyles = makeStyles(theme => ({ } })); -const SignInForm: React.FC<PropTypes> = ({ setUser }) => { +const SignInForm: React.FC<PropTypes> = ({ setUser, navigate }) => { const classes = useStyles(); const inputRef = useRef<HTMLInputElement>(); @@ -33,6 +34,7 @@ const SignInForm: React.FC<PropTypes> = ({ setUser }) => { const user = response.data[0]; setUser(user); localStorage.setItem('userId', user._id); + navigate('profile', user._id); }); } }; |