aboutsummaryrefslogtreecommitdiff
path: root/src/pages/ProfilePage/ProfilePage.tsx
diff options
context:
space:
mode:
authorEugene Sokolov <eug-vs@keemail.me>2020-06-15 15:55:16 +0300
committerGitHub <noreply@github.com>2020-06-15 15:55:16 +0300
commit185ab6f4025ff41313b12efb8cff49009c1af85e (patch)
treec394f99472b4c0b7ee95bec1813832c922dd5477 /src/pages/ProfilePage/ProfilePage.tsx
parent987c050faa5353ae2f250d82055d6685fefa58f7 (diff)
parent2a65284a385915818ca5f3e3b7354554e19af9cb (diff)
downloadwhich-ui-185ab6f4025ff41313b12efb8cff49009c1af85e.tar.gz
Merge pull request #36 from ilyayudovin/other-profiles
Profiles
Diffstat (limited to 'src/pages/ProfilePage/ProfilePage.tsx')
-rw-r--r--src/pages/ProfilePage/ProfilePage.tsx11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/pages/ProfilePage/ProfilePage.tsx b/src/pages/ProfilePage/ProfilePage.tsx
index 984fb1e..0f5fb2b 100644
--- a/src/pages/ProfilePage/ProfilePage.tsx
+++ b/src/pages/ProfilePage/ProfilePage.tsx
@@ -1,4 +1,4 @@
-import React, { useState,useEffect } from 'react';
+import React, { useState, useEffect } from 'react';
import { User, Poll } from '../../types';
import ProfileInfo from './ProfileInfo';
import Feed from '../../components/Feed/Feed';
@@ -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} />
</>
);
};