diff options
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/Feed/Feed.tsx | 2 | ||||
-rw-r--r-- | src/components/PollCard/PollCard.tsx | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/components/Feed/Feed.tsx b/src/components/Feed/Feed.tsx index 3b8e16f..c649935 100644 --- a/src/components/Feed/Feed.tsx +++ b/src/components/Feed/Feed.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { makeStyles } from '@material-ui/core/styles'; -import { Poll } from '../../types'; +import { Poll } from 'which-types'; import PollCard from '../PollCard/PollCard'; interface PropTypes { diff --git a/src/components/PollCard/PollCard.tsx b/src/components/PollCard/PollCard.tsx index 190d001..9f89d9a 100644 --- a/src/components/PollCard/PollCard.tsx +++ b/src/components/PollCard/PollCard.tsx @@ -7,7 +7,8 @@ import { Avatar, CardHeader } from '@material-ui/core/'; -import { Poll } from '../../types'; +import { Which, Poll } from 'which-types'; + import PercentageBar from './PercentageBar'; import {post} from '../../requests'; import teal from "@material-ui/core/colors/teal"; @@ -56,7 +57,7 @@ const PollCard: React.FC<PropTypes> = ({ poll, navigate }) => { navigate('profile', poll.author._id); }; - const vote = (which: 'left' | 'right') => { + const vote = (which: Which) => { post(`polls/${ poll._id }/votes/`,{ which }).then((response)=>{ console.log(response.data); const leftV = response.data.contents.left.votes; @@ -78,12 +79,12 @@ const PollCard: React.FC<PropTypes> = ({ poll, navigate }) => { <Avatar aria-label="avatar" src={author.avatarUrl} - alt={author.name[0].toUpperCase()} + alt={author.username[0].toUpperCase()} onClick={handleNavigate} className={classes.avatar} /> )} - title={author.name} + title={author.username} /> <div className={classes.imagesBlock}> <CardActionArea onDoubleClick={() => vote('left')}> |