aboutsummaryrefslogtreecommitdiff
path: root/src/pages/FeedPage/PollSubmission.tsx
diff options
context:
space:
mode:
authorilyayudovin <ilyayudovin123@gmail.com>2020-06-29 17:31:51 +0300
committerilyayudovin <ilyayudovin123@gmail.com>2020-06-29 17:31:51 +0300
commit856522da17348e54b0d390f10772c21b4029e9bd (patch)
treee3642a46d926b6dc4ceae041083112492486c410 /src/pages/FeedPage/PollSubmission.tsx
parent0852cbeea6a3872c4a3a4b7dd974db53eb0a85dd (diff)
downloadwhich-ui-856522da17348e54b0d390f10772c21b4029e9bd.tar.gz
fix: make code redably clear
Diffstat (limited to 'src/pages/FeedPage/PollSubmission.tsx')
-rw-r--r--src/pages/FeedPage/PollSubmission.tsx14
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'
}