From e92130e19c67f52a4fcc4db8bd75122039f4c4c3 Mon Sep 17 00:00:00 2001
From: pdg16 <pdg16@inf.ufpr.br>
Date: Wed, 29 Jan 2020 09:47:29 -0300
Subject: [PATCH] reload page after submit

---
 src/App.js | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/App.js b/src/App.js
index ffe8a70..191fcf6 100644
--- a/src/App.js
+++ b/src/App.js
@@ -118,18 +118,18 @@ function App() {
           "placement": index-1,
           "description": "Adicionar esse campo no front",
           "question": x.question,
-          "enabled": x.required,
+          "enabled": true,
           "type": 0, // question type = 0
-          "validation": []
+          "validation": x.required ? [{"type": 2, "arguments": ""}] : []
         });
       } else if(x.type === "select") {
         json.inputs.push({
           "placement": index-1,
           "description": "Adicionar esse campo no front",
           "question": x.question,
-          "enabled": x.required,
+          "enabled": true,
           "type": 3, // select type = 3
-          "validation": [],
+          "validation": x.required ? [{"type": 2, "arguments": ""}] : [],
           "sugestions": x.options.map(function(y, index) { return {value: y, placement: index} })
         });
       } else if(x.type === "checkbox") {
@@ -137,9 +137,9 @@ function App() {
           "placement": index-1,
           "description": "Adicionar esse campo no front",
           "question": x.question,
-          "enabled": x.required,
+          "enabled": true,
           "type": 1, // checkbox type = 1
-          "validation": [],
+          "validation": x.required ? [{"type": 2, "arguments": ""}] : [],
           "sugestions": x.options.map(function(y, index) { return {value: y, placement: index} })
         });
       } else if(x.type === "radio") {
@@ -147,9 +147,9 @@ function App() {
           "placement": index-1,
           "description": "Adicionar esse campo no front",
           "question": x.question,
-          "enabled": x.required,
+          "enabled": true,
           "type": 2, // radio type = 2
-          "validation": [],
+          "validation": x.required ? [{"type": 2, "arguments": ""}] : [],
           "sugestions": x.options.map(function(y, index) { return {value: y, placement: index} })
         });
       }
@@ -161,7 +161,10 @@ function App() {
       .then(res => {
         console.log(res);
         console.log(res.data);
+
+        window.location.reload();
       });
+    
   }
 
   return (
-- 
GitLab