From f9999d6da7752a55ad01f85dce34086c1acbff5a Mon Sep 17 00:00:00 2001 From: ilyayudovin Date: Wed, 1 Jul 2020 15:26:08 +0300 Subject: move snack provider to Page component --- src/components/PollCard/PollCard.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/components/PollCard') 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 = ({ 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 => { -- cgit v1.2.3