From c7f2999ee797ea5e3bfb29517a4f13206162cc6f Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sun, 14 Jun 2020 19:52:35 +0300
Subject: refactor: use lowercase in folder names

---
 src/pages/ProfilePage/ProfilePage.tsx | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 src/pages/ProfilePage/ProfilePage.tsx

(limited to 'src/pages/ProfilePage/ProfilePage.tsx')

diff --git a/src/pages/ProfilePage/ProfilePage.tsx b/src/pages/ProfilePage/ProfilePage.tsx
new file mode 100644
index 0000000..ee95769
--- /dev/null
+++ b/src/pages/ProfilePage/ProfilePage.tsx
@@ -0,0 +1,25 @@
+import React from 'react';
+import { User } from '../../types';
+import SignInForm from './SignInForm';
+import ProfileInfo from './ProfileInfo';
+import Feed from '../../components/Feed/Feed';
+
+interface PropTypes {
+  setUser: (newUser: User | undefined) => void;
+  user: User | undefined;
+}
+
+const ProfilePage: React.FC<PropTypes> = ({ setUser, user }) => {
+  return (
+    user
+      ? (
+        <>
+          <ProfileInfo id={user?._id} setUser={setUser} />
+          <Feed page="Feed" />
+        </>
+      )
+      : <SignInForm setUser={setUser} />
+  );
+};
+
+export default ProfilePage;
-- 
cgit v1.2.3


From 61a424debfbfa98570e070fbf25d03aa9c56d679 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sun, 14 Jun 2020 20:39:16 +0300
Subject: refactor: structurize pages

---
 src/pages/ProfilePage/ProfilePage.tsx | 37 +++++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 15 deletions(-)

(limited to 'src/pages/ProfilePage/ProfilePage.tsx')

diff --git a/src/pages/ProfilePage/ProfilePage.tsx b/src/pages/ProfilePage/ProfilePage.tsx
index ee95769..023f37c 100644
--- a/src/pages/ProfilePage/ProfilePage.tsx
+++ b/src/pages/ProfilePage/ProfilePage.tsx
@@ -1,25 +1,32 @@
-import React from 'react';
-import { User } from '../../types';
-import SignInForm from './SignInForm';
+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 {
-  setUser: (newUser: User | undefined) => void;
-  user: User | undefined;
+  logOut: () => void;
+  id: string;
 }
 
-const ProfilePage: React.FC<PropTypes> = ({ setUser, user }) => {
+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 (
-    user
-      ? (
-        <>
-          <ProfileInfo id={user?._id} setUser={setUser} />
-          <Feed page="Feed" />
-        </>
-      )
-      : <SignInForm setUser={setUser} />
-  );
+    <>
+      <ProfileInfo user={userInfo} logOut={logOut} />
+      <Feed polls={polls} />
+    </>
+  )
 };
 
 export default ProfilePage;
-- 
cgit v1.2.3


From fbe489c83e9ef4c03b87624a4dec66de61af364a Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sun, 14 Jun 2020 20:43:05 +0300
Subject: style: fix eslint errors

---
 src/pages/ProfilePage/ProfilePage.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/pages/ProfilePage/ProfilePage.tsx')

diff --git a/src/pages/ProfilePage/ProfilePage.tsx b/src/pages/ProfilePage/ProfilePage.tsx
index 023f37c..1dd71d3 100644
--- a/src/pages/ProfilePage/ProfilePage.tsx
+++ b/src/pages/ProfilePage/ProfilePage.tsx
@@ -26,7 +26,7 @@ const ProfilePage: React.FC<PropTypes> = ({ logOut, id }) => {
       <ProfileInfo user={userInfo} logOut={logOut} />
       <Feed polls={polls} />
     </>
-  )
+  );
 };
 
 export default ProfilePage;
-- 
cgit v1.2.3

