diff options
author | ilyayudovin <ilyayudovin123@gmail.com> | 2020-06-27 17:53:31 +0300 |
---|---|---|
committer | ilyayudovin <ilyayudovin123@gmail.com> | 2020-06-27 17:53:31 +0300 |
commit | 490904d9299df636134b82d5507e629f570a1791 (patch) | |
tree | bb321b38e6f14c7d020de65ab1bf0c03452ef893 /src/pages/ProfilePage/ProfilePage.tsx | |
parent | e199f28a384dfd6fdf71e6ddaa21799096099cf9 (diff) | |
download | which-ui-490904d9299df636134b82d5507e629f570a1791.tar.gz |
change avata image right after submit
Diffstat (limited to 'src/pages/ProfilePage/ProfilePage.tsx')
-rw-r--r-- | src/pages/ProfilePage/ProfilePage.tsx | 9 |
1 files changed, 5 insertions, 4 deletions
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} /> </> ); }; |