Skip to content
Snippets Groups Projects
Commit bfb3a906 authored by mrp19's avatar mrp19
Browse files

Fix logic on submit form

parent 700502ea
No related branches found
No related tags found
3 merge requests!57Merge of develop into master,!56Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...,!15Resolve "Criar telas da central de ajuda"
......@@ -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`,
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment