diff options
author | eug-vs <eug-vs@keemail.me> | 2020-06-14 22:42:52 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-06-14 22:42:52 +0300 |
commit | c311c538a3442aed8d77449736f28be66feea57c (patch) | |
tree | e555dd765c690e3e269996d00a08814afad700d4 /src/pages/ProfilePage/ProfilePage.tsx | |
parent | 14b70c34a1b88c83e89f483399debd60560ed70b (diff) | |
download | which-ui-c311c538a3442aed8d77449736f28be66feea57c.tar.gz |
feat: configure navigation
Diffstat (limited to 'src/pages/ProfilePage/ProfilePage.tsx')
-rw-r--r-- | src/pages/ProfilePage/ProfilePage.tsx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/pages/ProfilePage/ProfilePage.tsx b/src/pages/ProfilePage/ProfilePage.tsx index 984fb1e..46637cb 100644 --- a/src/pages/ProfilePage/ProfilePage.tsx +++ b/src/pages/ProfilePage/ProfilePage.tsx @@ -6,10 +6,11 @@ import { get } from '../../requests'; interface PropTypes { logOut: () => void; + navigate: (prefix: string, id: string) => void; id: string; } -const ProfilePage: React.FC<PropTypes> = ({ logOut, id }) => { +const ProfilePage: React.FC<PropTypes> = ({ logOut, id, navigate }) => { const [userInfo, setUserInfo] = useState<User>(); const [polls, setPolls] = useState<Poll[]>([]); @@ -17,19 +18,19 @@ const ProfilePage: React.FC<PropTypes> = ({ logOut, id }) => { get(`/users/${id}`).then(response => { setUserInfo(response.data); }); - },[]); + }, [id]); useEffect(() => { get(`/profiles/${id}`).then(response => { setPolls(response.data); }); - },[]); + }, [id]); return ( <> <ProfileInfo user={userInfo} logOut={logOut} /> - <Feed polls={polls} /> + <Feed polls={polls} navigate={navigate} /> </> ); }; |