diff options
Diffstat (limited to 'src/containers')
| -rw-r--r-- | src/containers/FeedPage/FeedPage.tsx | 8 | ||||
| -rw-r--r-- | src/containers/ProfilePage/ProfilePage.tsx | 9 | 
2 files changed, 9 insertions, 8 deletions
| diff --git a/src/containers/FeedPage/FeedPage.tsx b/src/containers/FeedPage/FeedPage.tsx index da0fb2a..7445c25 100644 --- a/src/containers/FeedPage/FeedPage.tsx +++ b/src/containers/FeedPage/FeedPage.tsx @@ -2,23 +2,23 @@ import React from 'react';  import { Poll } from 'which-types';  import { Container } from '@material-ui/core/'; -import Feed from '../../components/Feed/Feed'; +import PollsList from '../../components/PollsList/PollsList';  import PollSubmission from './PollSubmission';  import { useAuth } from '../../hooks/useAuth';  import { useFeed } from '../../hooks/APIClient';  const FeedPage: React.FC = () => { -  const { data, mutate } = useFeed(); +  const { data: polls, mutate } = useFeed();    const { isAuthenticated } = useAuth();    const addPoll = (poll: Poll): void => { -    mutate([poll, ...data], true); +    mutate([poll, ...polls], true);    };    return (      <Container maxWidth="sm" disableGutters>        {isAuthenticated && <PollSubmission addPoll={addPoll} />} -      <Feed polls={data} /> +      <PollsList polls={polls} mutate={mutate} />      </Container>    );  }; 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>    ); | 
