diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/Feed/Feed.tsx | 2 | ||||
| -rw-r--r-- | src/pages/ProfilePage/ProfileInfo.tsx | 4 | ||||
| -rw-r--r-- | src/pages/ProfilePage/ProfilePage.tsx | 9 | 
3 files changed, 8 insertions, 7 deletions
| diff --git a/src/components/Feed/Feed.tsx b/src/components/Feed/Feed.tsx index d81da99..06b5087 100644 --- a/src/components/Feed/Feed.tsx +++ b/src/components/Feed/Feed.tsx @@ -18,7 +18,7 @@ const useStyles = makeStyles(theme => ({  const Feed: React.FC<PropTypes> = ({ polls, navigate }) => {    const classes = useStyles(); - +  console.log(polls);    return (      <div className={classes.root}>        {polls.map(poll => <PollCard initialPoll={poll} key={poll._id} navigate={navigate} />)} diff --git a/src/pages/ProfilePage/ProfileInfo.tsx b/src/pages/ProfilePage/ProfileInfo.tsx index 6578764..6a2f853 100644 --- a/src/pages/ProfilePage/ProfileInfo.tsx +++ b/src/pages/ProfilePage/ProfileInfo.tsx @@ -36,7 +36,8 @@ const useStyles = makeStyles({      display: 'flex',      width: '100%',      height: 50, -    margin: '50px 0' +    margin: '50px 0', +    borderBottom: '1px solid lightgray'    },    menuButton: {      width: 200, @@ -78,7 +79,6 @@ const ProfileInfo: React.FC<PropTypes> = ({user, logOut,savedPolls, totalVotes,      input === false ? setInput(true) : setInput(false);    }; -    return (      <div className={classes.root}>        { diff --git a/src/pages/ProfilePage/ProfilePage.tsx b/src/pages/ProfilePage/ProfilePage.tsx index b2ca0a0..479fd5c 100644 --- a/src/pages/ProfilePage/ProfilePage.tsx +++ b/src/pages/ProfilePage/ProfilePage.tsx @@ -25,7 +25,9 @@ const ProfilePage: React.FC<PropTypes> = ({ logOut, id, navigate,setUser }) => {    useEffect(() => {      get(`/profiles/${id}`).then(response => { -      setPolls(response.data); +      setPolls([]); +      setPolls([...response.data]); +        // const x = response.data.reduce((a: any, c: any) => a.contents.left.votes + c.contents.left.votes);        // const y = response.data.reduce((a: any, c: any) => a.contents.right.votes + c.contents.right.votes);        let sum = 0; @@ -35,13 +37,12 @@ const ProfilePage: React.FC<PropTypes> = ({ logOut, id, navigate,setUser }) => {        }        setTotalVotes(sum);      }); -  }, [id]); - +  }, [id, userInfo]);    return (      <>        <ProfileInfo user={userInfo} setUserInfo={setUserInfo} setUser={setUser} logOut={logOut} savedPolls={polls.length} totalVotes={totalVotes}/> -      <Feed polls={polls} navigate={navigate} /> +      <Feed polls={[...polls]} navigate={navigate} />      </>    );  }; | 
