aboutsummaryrefslogtreecommitdiff
path: root/src/containers/Feed/Feed.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/containers/Feed/Feed.tsx')
-rw-r--r--src/containers/Feed/Feed.tsx12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/containers/Feed/Feed.tsx b/src/containers/Feed/Feed.tsx
index 10b1adc..337f4c1 100644
--- a/src/containers/Feed/Feed.tsx
+++ b/src/containers/Feed/Feed.tsx
@@ -3,18 +3,26 @@ import { Container } from '@material-ui/core/';
import PollsList from '../../components/PollsList/PollsList';
import Fab from '../../components/Fab/Fab';
+import Loading from '../../components/Loading/Loading';
+import EmptyState from '../../components/EmptyState/EmptyState';
import { useAuth } from '../../hooks/useAuth';
import { useFeed } from '../../hooks/APIClient';
const Feed: React.FC = () => {
- const { data: polls, mutate } = useFeed();
+ const { data: polls, isValidating, mutate } = useFeed();
const { isAuthenticated } = useAuth();
return (
<Container maxWidth="sm" disableGutters>
{isAuthenticated && <Fab hideOnScroll />}
- <PollsList polls={polls} mutate={mutate} />
+ {
+ polls
+ ? polls.length
+ ? <PollsList polls={polls} mutate={mutate} />
+ : <EmptyState />
+ : isValidating && <Loading />
+ }
</Container>
);
};