aboutsummaryrefslogtreecommitdiff
path: root/src/pages/ProfilePage/ProfilePage.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages/ProfilePage/ProfilePage.tsx')
-rw-r--r--src/pages/ProfilePage/ProfilePage.tsx32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/pages/ProfilePage/ProfilePage.tsx b/src/pages/ProfilePage/ProfilePage.tsx
new file mode 100644
index 0000000..1dd71d3
--- /dev/null
+++ b/src/pages/ProfilePage/ProfilePage.tsx
@@ -0,0 +1,32 @@
+import React, { useState } from 'react';
+import { User, Poll } from '../../types';
+import ProfileInfo from './ProfileInfo';
+import Feed from '../../components/Feed/Feed';
+import { get } from '../../requests';
+
+interface PropTypes {
+ logOut: () => void;
+ id: string;
+}
+
+const ProfilePage: React.FC<PropTypes> = ({ logOut, id }) => {
+ const [userInfo, setUserInfo] = useState<User>();
+ const [polls, setPolls] = useState<Poll[]>([]);
+
+ get(`/users/${id}`).then(response => {
+ setUserInfo(response.data);
+ });
+
+ get(`/profiles/${id}`).then(response => {
+ setPolls(response.data);
+ });
+
+ return (
+ <>
+ <ProfileInfo user={userInfo} logOut={logOut} />
+ <Feed polls={polls} />
+ </>
+ );
+};
+
+export default ProfilePage;