From bfb3a9064190b0e2fa0700e8da2b57caa24f9a93 Mon Sep 17 00:00:00 2001
From: Riba <mrp19@inf.ufpr.br>
Date: Tue, 11 Feb 2020 08:48:23 -0300
Subject: [PATCH] Fix logic on submit form

---
 src/Components/ContactForm.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Components/ContactForm.js b/src/Components/ContactForm.js
index 41870637..9bd68cf4 100644
--- a/src/Components/ContactForm.js
+++ b/src/Components/ContactForm.js
@@ -94,7 +94,7 @@ const Button = styled.button`
 
   function validateEmail (email) {
     let flag = false
-    if (email.split("").filter(x => x === "@").length !== 1) {
+    if (email.split("").filter(x => x === "@").length !== 1 || email.length < 7) {
       flag = true
     }
     return flag
@@ -188,7 +188,7 @@ const Button = styled.button`
       e.preventDefault(); //though this is arguable
       console.log(!(nome.dict.key && email.dict.key && mensagem.dict.key ))
       // Se não houver erro em nunhum dos campos E nenhum dos campos for vazio: a página faz o contato com o backend e os campos ficam em branco no formulário
-      if (!(nome.dict.key && email.dict.key && mensagem.dict.key ) && ((nome.dict.value.length > 0) && (email.dict.value.length > 0) && (mensagem.dict.value.length > 0))) {
+      if (!(nome.dict.key || email.dict.key || mensagem.dict.key )) {
 
         axios.post(`${apiUrl}/contacts`,
             {
-- 
GitLab