From cab8de5c6b246e1aa1376fa2b8666f09b44b6469 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Mon, 10 Aug 2020 11:12:06 +0300
Subject: refator: Feed -> PollList

---
 src/containers/ProfilePage/ProfilePage.tsx | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

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

diff --git a/src/containers/ProfilePage/ProfilePage.tsx b/src/containers/ProfilePage/ProfilePage.tsx
index db27d25..7a1d729 100644
--- a/src/containers/ProfilePage/ProfilePage.tsx
+++ b/src/containers/ProfilePage/ProfilePage.tsx
@@ -4,7 +4,7 @@ import { Poll } from 'which-types';
 import { Container } from '@material-ui/core';
 
 import ProfileInfo from './ProfileInfo';
-import Feed from '../../components/Feed/Feed';
+import PollsList from '../../components/PollsList/PollsList';
 import Loading from '../../components/Loading/Loading';
 import { useAuth } from '../../hooks/useAuth';
 import { useUser, useProfile } from '../../hooks/APIClient';
@@ -16,7 +16,7 @@ const ProfilePage: React.FC = () => {
   const { user } = useAuth();
 
   const { data: userInfo, mutate: setUserInfo } = useUser(username);
-  const { data: polls, isValidating } = useProfile(userInfo?._id);
+  const { data: polls, mutate: mutatePolls, isValidating } = useProfile(userInfo?._id);
 
   useEffect(() => {
     if (!username) {
@@ -44,9 +44,10 @@ const ProfilePage: React.FC = () => {
         savedPolls={polls.length}
         totalVotes={totalVotes}
       />
-      {!polls.length && isValidating
+      {
+        isValidating && !polls
         ? <Loading />
-        : <Feed polls={polls} />
+        : <PollsList polls={polls} mutate={mutatePolls} />
       }
     </Container>
   );
-- 
cgit v1.2.3

