From 319e7fc67dd4329606b09dca1cb78ea132b1264a Mon Sep 17 00:00:00 2001
From: ilyayudovin <ilyayudovin123@gmail.com>
Date: Fri, 11 Sep 2020 02:11:54 +0300
Subject: fix eslint errors

---
 src/components/PollCard/PollCard.tsx | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)

(limited to 'src/components/PollCard/PollCard.tsx')

diff --git a/src/components/PollCard/PollCard.tsx b/src/components/PollCard/PollCard.tsx
index 87d9fae..56f5dbd 100644
--- a/src/components/PollCard/PollCard.tsx
+++ b/src/components/PollCard/PollCard.tsx
@@ -51,26 +51,9 @@ const PollCard: React.FC<PropTypes> = React.memo(({ poll, setPoll }) => {
   const { enqueueSnackbar } = useSnackbar();
   const { isAuthenticated } = useAuth();
   const date: string = new Date(poll.createdAt).toLocaleString('default', DATE_FORMAT);
-  let timer: any;
-  let delay = 200;
+  let timer: ReturnType<typeof setTimeout>;
   let prevent = false;
 
-  const handleClick = (which: Which) => () => {
-    if(!prevent) {
-      prevent = true;
-      timer = setTimeout(() => {
-        console.log('single click', prevent);
-        prevent = false;
-      }, delay)
-    }
-    else {
-      clearTimeout(timer);
-      prevent = false;
-      console.log('double click', prevent);
-      handleVote(which);
-    }
-  };
-
   const handleVote = (which: Which) => {
     if (!isAuthenticated) {
       enqueueSnackbar('Unauthorized users can not vote in polls', {
@@ -96,6 +79,19 @@ const PollCard: React.FC<PropTypes> = React.memo(({ poll, setPoll }) => {
     }
   };
 
+  const handleClick = (which: Which) => () => {
+    if (!prevent) {
+      prevent = true;
+      timer = setTimeout(() => {
+        prevent = false;
+      }, 200);
+    } else {
+      clearTimeout(timer);
+      prevent = false;
+      handleVote(which);
+    }
+  };
+
   let leftPercentage;
   let rightPercentage;
 
-- 
cgit v1.2.3

