diff options
author | Eugene Sokolov <eug-vs@keemail.me> | 2020-06-14 20:44:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-14 20:44:40 +0300 |
commit | 65e41d1d8a3844a6d7268340f5d88b5957e2355d (patch) | |
tree | 3d455f133b5afa1e6a1c30c4589ef3db39dd4c4e /src/Feed/Feed.tsx | |
parent | 99b44bc80fa3228131a05fccb13f75ff8a46b116 (diff) | |
parent | fbe489c83e9ef4c03b87624a4dec66de61af364a (diff) | |
download | which-ui-65e41d1d8a3844a6d7268340f5d88b5957e2355d.tar.gz |
Merge pull request #33 from ilyayudovin/pages
divide src into Pages and Components directories
Diffstat (limited to 'src/Feed/Feed.tsx')
-rw-r--r-- | src/Feed/Feed.tsx | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/Feed/Feed.tsx b/src/Feed/Feed.tsx deleted file mode 100644 index d7bfce1..0000000 --- a/src/Feed/Feed.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { makeStyles } from '@material-ui/core/styles'; -import { Poll } from '../types'; -import PollCard from '../PollCard/PollCard'; -import { get } from '../requests'; - -interface PropTypes { - page: string; -} - -const useStyles = makeStyles(theme => ({ - root: { - position: 'relative', - maxWidth: theme.spacing(75), - margin: '0 auto' - } -})); - -const Feed: React.FC<PropTypes> = ({ page }) => { - const [polls, setPolls] = useState<Poll[]>([]); - const classes = useStyles(); - - let endpoint = '/polls'; - // TODO: Make this work - if (page === 'feed') endpoint = '/polls'; - - useEffect(() => { - get(endpoint).then(response => { - setPolls(response.data); - }); - }, [endpoint]); - - return ( - <div className={classes.root}> - {polls.map(poll => <PollCard poll={poll} key={poll._id} />)} - </div> - ); -}; - -export default Feed; - |