aboutsummaryrefslogtreecommitdiff
path: root/src/containers/ProfilePage/ProfilePage.tsx
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-08-10 11:12:06 +0300
committereug-vs <eug-vs@keemail.me>2020-08-10 11:12:06 +0300
commitcab8de5c6b246e1aa1376fa2b8666f09b44b6469 (patch)
tree5e6c1105455bf3aadd1b987680a2814d8ce6ef07 /src/containers/ProfilePage/ProfilePage.tsx
parent08e9e3abb9830b6c46f46aacb6a40ba32c4c665f (diff)
downloadwhich-ui-cab8de5c6b246e1aa1376fa2b8666f09b44b6469.tar.gz
refator: Feed -> PollList
Diffstat (limited to 'src/containers/ProfilePage/ProfilePage.tsx')
-rw-r--r--src/containers/ProfilePage/ProfilePage.tsx9
1 files changed, 5 insertions, 4 deletions
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>
);