diff options
author | Eugene Sokolov <eug-vs@keemail.me> | 2020-06-15 15:55:16 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-15 15:55:16 +0300 |
commit | 185ab6f4025ff41313b12efb8cff49009c1af85e (patch) | |
tree | c394f99472b4c0b7ee95bec1813832c922dd5477 /src/pages/AuthPage | |
parent | 987c050faa5353ae2f250d82055d6685fefa58f7 (diff) | |
parent | 2a65284a385915818ca5f3e3b7354554e19af9cb (diff) | |
download | which-ui-185ab6f4025ff41313b12efb8cff49009c1af85e.tar.gz |
Merge pull request #36 from ilyayudovin/other-profiles
Profiles
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); }); } }; |