Browse Source

Save email correctly

Tatiana Inama 6 years atrás
parent
commit
8600999e3d
1 changed files with 3 additions and 7 deletions
  1. 3 7
      src/App.tsx

+ 3 - 7
src/App.tsx

@@ -124,7 +124,7 @@ const App = () => {
     setCurrentPage(currentPage + 1);
     setCurrentPage(currentPage + 1);
     window.scrollTo(0, 0);
     window.scrollTo(0, 0);
   }
   }
-  const uploadData = () => {
+  const uploadData = (email?: string) => {
     const data = {
     const data = {
       personalInformation: answers.personalInformation,
       personalInformation: answers.personalInformation,
       canvas: answers.canvas.map(data => ({
       canvas: answers.canvas.map(data => ({
@@ -132,7 +132,7 @@ const App = () => {
         path: data.path.exportJSON()
         path: data.path.exportJSON()
       })),
       })),
       canvasSize: answers.canvasSize,
       canvasSize: answers.canvasSize,
-      email: answers.email
+      email: email
     };
     };
     const postRequest = new XMLHttpRequest();
     const postRequest = new XMLHttpRequest();
     postRequest.open('POST', '/backend/', true);
     postRequest.open('POST', '/backend/', true);
@@ -168,11 +168,7 @@ const App = () => {
     }),
     }),
     FollowUp({
     FollowUp({
       saveData: (email) => {
       saveData: (email) => {
-        saveAnswers({
-          ...answers,
-          email,
-        });
-        uploadData();
+        uploadData(email);
         changePage();
         changePage();
       }
       }
     }),
     }),