diff options
Diffstat (limited to 'src/pages')
-rw-r--r-- | src/pages/ProfilePage/ProfileInfo.tsx | 4 | ||||
-rw-r--r-- | src/pages/ProfilePage/ProfilePage.tsx | 9 |
2 files changed, 7 insertions, 6 deletions
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} /> </> ); }; |