diff options
author | ilyayudovin <ilyayudovin123@gmail.com> | 2020-06-29 17:31:51 +0300 |
---|---|---|
committer | ilyayudovin <ilyayudovin123@gmail.com> | 2020-06-29 17:31:51 +0300 |
commit | 856522da17348e54b0d390f10772c21b4029e9bd (patch) | |
tree | e3642a46d926b6dc4ceae041083112492486c410 /src/pages/FeedPage/PollSubmission.tsx | |
parent | 0852cbeea6a3872c4a3a4b7dd974db53eb0a85dd (diff) | |
download | which-ui-856522da17348e54b0d390f10772c21b4029e9bd.tar.gz |
fix: make code redably clear
Diffstat (limited to 'src/pages/FeedPage/PollSubmission.tsx')
-rw-r--r-- | src/pages/FeedPage/PollSubmission.tsx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/pages/FeedPage/PollSubmission.tsx b/src/pages/FeedPage/PollSubmission.tsx index 65e33b6..3a73d45 100644 --- a/src/pages/FeedPage/PollSubmission.tsx +++ b/src/pages/FeedPage/PollSubmission.tsx @@ -38,7 +38,7 @@ const useStyles = makeStyles(theme => ({ } })); -const PollSubmission: React.FC<PropTypes> = ({ user , polls, setPolls}) => { +const PollSubmission: React.FC<PropTypes> = ({ user, polls, setPolls }) => { const classes = useStyles(); const [expanded, setExpanded] = useState(false); const [contents, setContents] = useState<Contents>({ @@ -56,9 +56,9 @@ const PollSubmission: React.FC<PropTypes> = ({ user , polls, setPolls}) => { const handleClick = () => { if (expanded) { - if(contents.left.url && contents.right.url ) { - post('/polls/', {authorId: user._id, contents}).then(res => { - polls.unshift({...res.data}); + if (contents.left.url && contents.right.url) { + post('/polls/', { authorId: user._id, contents }).then(res => { + polls.unshift({ ...res.data }); setPolls([...polls]); }); } @@ -73,13 +73,13 @@ const PollSubmission: React.FC<PropTypes> = ({ user , polls, setPolls}) => { <UserStrip user={user} info="" navigate={() => {}} /> <Divider /> <CardMedia className={classes.card}> - <PollSubmissionImage which="left" setContents={setContents} contents={contents}/> - <PollSubmissionImage which="right" setContents={setContents} contents={contents}/> + <PollSubmissionImage which="left" setContents={setContents} contents={contents} /> + <PollSubmissionImage which="right" setContents={setContents} contents={contents} /> </CardMedia> </Collapse> <Button onClick={handleClick} color="primary" variant="outlined" className={classes.button}> { - expanded === false + !expanded ? 'Create a Poll' : 'Submit' } |