aboutsummaryrefslogtreecommitdiff
path: root/src/pages/ProfilePage/ProfilePage.tsx
diff options
context:
space:
mode:
authorEugene Sokolov <eug-vs@keemail.me>2020-07-04 00:27:27 +0300
committerGitHub <noreply@github.com>2020-07-04 00:27:27 +0300
commit1109b6a11db65e6ef87b2590ffcc3b8df2b4de31 (patch)
treef04d14c59cec740425a1df6714ebe3cc1f22d3e5 /src/pages/ProfilePage/ProfilePage.tsx
parented0117c9c7a60b285eb8e47bbd925e222184df51 (diff)
parent79b77845dda41f5cc66cd736dff73817f4af1fe8 (diff)
downloadwhich-ui-1109b6a11db65e6ef87b2590ffcc3b8df2b4de31.tar.gz
Merge pull request #60 from which-ecosystem/skeleton
add skeleton to avatar page
Diffstat (limited to 'src/pages/ProfilePage/ProfilePage.tsx')
-rw-r--r--src/pages/ProfilePage/ProfilePage.tsx4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pages/ProfilePage/ProfilePage.tsx b/src/pages/ProfilePage/ProfilePage.tsx
index b7a4a75..ba4db7d 100644
--- a/src/pages/ProfilePage/ProfilePage.tsx
+++ b/src/pages/ProfilePage/ProfilePage.tsx
@@ -15,9 +15,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);
@@ -31,6 +33,7 @@ const ProfilePage: React.FC = () => {
return total + left.votes + right.votes;
}, 0
));
+ setIsLoading(false);
});
} else navigate('auth');
}, [navigate, page, user]);
@@ -42,6 +45,7 @@ const ProfilePage: React.FC = () => {
setUserInfo={setUserInfo}
savedPolls={polls.length}
totalVotes={totalVotes}
+ loading={isLoading}
/>
<Feed polls={[...polls]} />
</Container>