From 9462c3936151ef61023a5804f9b25f8e59eeda5b Mon Sep 17 00:00:00 2001 From: Clement G Date: Sun, 26 Apr 2020 15:06:44 +0200 Subject: [PATCH] fix(check-field) : checkfield function have to check if label of candidate is not an empty string --- src/components/views/CreateElection.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/views/CreateElection.jsx b/src/components/views/CreateElection.jsx index 63890a1..bb702e9 100644 --- a/src/components/views/CreateElection.jsx +++ b/src/components/views/CreateElection.jsx @@ -264,14 +264,13 @@ class CreateElection extends Component { checkFields() { const { candidates, title } = this.state; - if (!candidates) { return { ok: false, msg: AT_LEAST_2_CANDIDATES_ERROR }; } let numCandidates = 0; candidates.forEach(c => { - if (c !== "") numCandidates += 1; + if (c.label !== "") numCandidates += 1; }); if (numCandidates < 2) { return { ok: false, msg: AT_LEAST_2_CANDIDATES_ERROR };