diff options
author | Blaster4385 <venkateshchaturvedi12@gmail.com> | 2022-08-19 23:51:13 +0530 |
---|---|---|
committer | Blaster4385 <venkateshchaturvedi12@gmail.com> | 2022-08-19 23:51:13 +0530 |
commit | 856728cfae03da554d4db91b0635a53f1c9f915c (patch) | |
tree | 1ce1fa3561dc6935f4f3aab521773145cdd3f7ec /client | |
parent | 6c867e639e565262bbf71342f953456a7d0b7f7a (diff) |
DeShit the api
Diffstat (limited to 'client')
-rw-r--r-- | client/src/pages/Enrollment/Enrollment.jsx | 18 | ||||
-rw-r--r-- | client/src/services/apiservice.js | 5 |
2 files changed, 17 insertions, 6 deletions
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('/') } } diff --git a/client/src/services/apiservice.js b/client/src/services/apiservice.js index 0aa9337..e989c01 100644 --- a/client/src/services/apiservice.js +++ b/client/src/services/apiservice.js @@ -23,3 +23,8 @@ export const sendOTP = async (payload) => { const response = await apiClient.post('/otp', payload) return response } + +export const sendMessage = async (payload) => { + const response = await apiClient.post('/message', payload) + return response +} |