diff options
author | ilyayudovin <ilyayudovin123@gmail.com> | 2020-07-03 23:58:34 +0300 |
---|---|---|
committer | ilyayudovin <ilyayudovin123@gmail.com> | 2020-07-03 23:58:34 +0300 |
commit | 79b77845dda41f5cc66cd736dff73817f4af1fe8 (patch) | |
tree | c40fe75ac7880e919591e2c6c8a8a177cc673456 /src/pages/ProfilePage/ProfilePage.tsx | |
parent | fc552cbf3ffcba6d2cc7003936f4b55378541525 (diff) | |
download | which-ui-79b77845dda41f5cc66cd736dff73817f4af1fe8.tar.gz |
feat: add skeleton to avatar page
Diffstat (limited to 'src/pages/ProfilePage/ProfilePage.tsx')
-rw-r--r-- | src/pages/ProfilePage/ProfilePage.tsx | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pages/ProfilePage/ProfilePage.tsx b/src/pages/ProfilePage/ProfilePage.tsx index 2c18466..82e5cd8 100644 --- a/src/pages/ProfilePage/ProfilePage.tsx +++ b/src/pages/ProfilePage/ProfilePage.tsx @@ -14,9 +14,11 @@ const ProfilePage: React.FC = () => { const [totalVotes, setTotalVotes] = useState<number>(0); const { page, navigate } = useNavigate(); const { user } = useAuth(); + const [isLoading, setIsLoading] = useState(false); useEffect(() => { const id = page?.id || user?._id; + setIsLoading(true); if (id) { get(`/users/${id}`).then(response => { setUserInfo(response.data); @@ -29,6 +31,7 @@ const ProfilePage: React.FC = () => { return total + left.votes + right.votes; }, 0 )); + setIsLoading(false); }); } else navigate('auth'); }, [navigate, page, user]); @@ -40,6 +43,7 @@ const ProfilePage: React.FC = () => { setUserInfo={setUserInfo} savedPolls={polls.length} totalVotes={totalVotes} + loading={isLoading} /> <Feed polls={[...polls]} /> </> |