diff options
author | ilyayudovin <ilyayudovin123@gmail.com> | 2020-07-01 15:26:08 +0300 |
---|---|---|
committer | ilyayudovin <ilyayudovin123@gmail.com> | 2020-07-01 15:26:08 +0300 |
commit | f9999d6da7752a55ad01f85dce34086c1acbff5a (patch) | |
tree | 7cfd6ff4b8bd154074b9a42aaf4efe5b9cd471e6 /src/components | |
parent | 75c1dac4bceddab1d94b9e43c2fb2035297eb6bd (diff) | |
download | which-ui-f9999d6da7752a55ad01f85dce34086c1acbff5a.tar.gz |
move snack provider to Page component
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/PollCard/PollCard.tsx | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/components/PollCard/PollCard.tsx b/src/components/PollCard/PollCard.tsx index ef7391e..12f7198 100644 --- a/src/components/PollCard/PollCard.tsx +++ b/src/components/PollCard/PollCard.tsx @@ -60,16 +60,11 @@ const PollCard: React.FC<PropTypes> = ({ initialPoll }) => { const { enqueueSnackbar } = useSnackbar(); const date: string = new Date(poll.createdAt).toLocaleString('default', DATE_FORMAT); - - const showSnackBar = (message: string) => { - enqueueSnackbar(message, { - variant: 'error' - }); - }; - const handleVote = (which: Which) => { if (vote) { - showSnackBar('You have already voted'); + enqueueSnackbar('You have already voted', { + variant: 'error' + }); return; } post('votes/', { which, pollId: poll._id }).then(response => { |