From 856728cfae03da554d4db91b0635a53f1c9f915c Mon Sep 17 00:00:00 2001
From: Blaster4385 <venkateshchaturvedi12@gmail.com>
Date: Fri, 19 Aug 2022 23:51:13 +0530
Subject:  DeShit the api

---
 client/src/pages/Enrollment/Enrollment.jsx | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

(limited to 'client/src/pages/Enrollment/Enrollment.jsx')

diff --git a/client/src/pages/Enrollment/Enrollment.jsx b/client/src/pages/Enrollment/Enrollment.jsx
index f180667..e0cfd84 100644
--- a/client/src/pages/Enrollment/Enrollment.jsx
+++ b/client/src/pages/Enrollment/Enrollment.jsx
@@ -33,7 +33,9 @@ const Enrollment = () => {
   const navigate = useNavigate()
   const [unverified, setUnverified] = useState(true)
 
-  const { mutate } = useMutation((payload) => createUser(payload))
+  const pushUser = useMutation((payload) => createUser(payload))
+
+  // const setConfirm = useMutation((payload) => sendMessage(payload))
 
   const handleSubmit = () => {
     if (page === 0) {
@@ -107,9 +109,7 @@ const Enrollment = () => {
     } else if (page === 6) {
       setPage(page + 1)
     } else if (page === 7) {
-      setPage(page + 1)
-    } else if (page === 8) {
-      mutate(
+      pushUser.mutate(
         {
           indianResident: userData.indianResident,
           name: userData.name,
@@ -127,11 +127,17 @@ const Enrollment = () => {
         },
         {
           onSuccess: () => {
-            setUserData(initialUserData)
-            navigate('/')
+            // setConfirm.mutate({
+            //   mobile: `+91${userData.mobile}`,
+            //   id: pushUser.data._id
+            // })
+            setPage(page + 1)
           }
         }
       )
+    } else if (page === 8) {
+      setUserData(initialUserData)
+      navigate('/')
     }
   }
 
-- 
cgit 

