Browse Source

Eliminated some redundant functions

luislopez66 2 years ago
parent
commit
8b6639be96
1 changed files with 6 additions and 28 deletions
  1. 6
    28
      MocionesIUPI/screens/MocionScreen.js

+ 6
- 28
MocionesIUPI/screens/MocionScreen.js View File

28
     }
28
     }
29
   }
29
   }
30
 
30
 
31
-  function getVotoFavorNums() {
31
+  function getVotosNums() {
32
     const [countFavor, setCountFavor] = useState(0);
32
     const [countFavor, setCountFavor] = useState(0);
33
+    const [countContra, setCountContra] = useState(0);
34
+    const [countAbstenid, setCountAbstenid] = useState(0);
33
 
35
 
34
     return (
36
     return (
35
       <div>
37
       <div>
36
         <button onClick={() => setCountFavor(countFavor + 1)}>
38
         <button onClick={() => setCountFavor(countFavor + 1)}>
37
-        A favor
39
+          A favor
38
         </button>
40
         </button>
39
-      </div>
40
-    );
41
-  }
42
-
43
-  function getVotoContraNums() {
44
-    const [countContra, setCountContra] = useState(0);
45
-
46
-    return (
47
-      <div>
48
         <button onClick={() => setCountContra(countContra + 1)}>
41
         <button onClick={() => setCountContra(countContra + 1)}>
49
-        En contra
42
+          En contra
50
         </button>
43
         </button>
51
-      </div>
52
-    );
53
-  }
54
-
55
-  function getVotoAbstenidNums() {
56
-    const [countAbstenid, setCountAbstenid] = useState(0);
57
-
58
-    return (
59
-      <div>
60
         <button onClick={() => setCountAbstenid(countAbstenid + 1)}>
44
         <button onClick={() => setCountAbstenid(countAbstenid + 1)}>
61
-        Abstenida/o
45
+          Abstenido
62
         </button>
46
         </button>
63
       </div>
47
       </div>
64
     );
48
     );
65
   }
49
   }
66
 
50
 
67
-  function getVotoNums() {
68
-    getVotoFavorNums();
69
-    getVotoContraNums();
70
-    getVotoAbstenidNums();
71
-  }
72
-
73
   const getVotos = async () => {
51
   const getVotos = async () => {
74
     try {
52
     try {
75
       const response = await fetch('http://10.190.1.140:5000/send?PIN=121071'); // connection to the website 
53
       const response = await fetch('http://10.190.1.140:5000/send?PIN=121071'); // connection to the website