diff options
author | rohan09-raj <rajrohan1914@gmail.com> | 2022-08-20 12:25:13 +0530 |
---|---|---|
committer | rohan09-raj <rajrohan1914@gmail.com> | 2022-08-20 12:25:13 +0530 |
commit | 3157d21013132015bb3e049a1114e0a0db18162e (patch) | |
tree | a4d2adf2d73d63f92da84a979623af683e3846ff /client | |
parent | 8eed2904d141d7c0b530cb0551364a0b226cf65a (diff) |
added docs
Diffstat (limited to 'client')
-rw-r--r-- | client/src/pages/Enrollment/Enrollment.jsx | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/client/src/pages/Enrollment/Enrollment.jsx b/client/src/pages/Enrollment/Enrollment.jsx index e0cfd84..8b62b3c 100644 --- a/client/src/pages/Enrollment/Enrollment.jsx +++ b/client/src/pages/Enrollment/Enrollment.jsx @@ -17,7 +17,7 @@ import { validPincode, validString } from '../../constants/RegEx' -import { createUser } from '../../services/apiservice' +import { createUser, sendMessage } from '../../services/apiservice' import { useTranslation } from 'react-i18next' import { ToastContainer, toast } from 'react-toastify' import 'react-toastify/dist/ReactToastify.css' @@ -33,9 +33,19 @@ const Enrollment = () => { const navigate = useNavigate() const [unverified, setUnverified] = useState(true) - const pushUser = useMutation((payload) => createUser(payload)) + const pushUser = useMutation((payload) => createUser(payload), { + onSuccess: () => { + console.log('Before mutate') + setConfirm.mutate({ + mobile: `+91${userData.mobile}`, + id: pushUser.data._id + }) + console.log('After mutate') + setPage(page + 1) + } + }) - // const setConfirm = useMutation((payload) => sendMessage(payload)) + const setConfirm = useMutation((payload) => sendMessage(payload)) const handleSubmit = () => { if (page === 0) { @@ -109,32 +119,21 @@ const Enrollment = () => { } else if (page === 6) { setPage(page + 1) } else if (page === 7) { - pushUser.mutate( - { - indianResident: userData.indianResident, - name: userData.name, - gender: userData.gender, - dob: userData.dob, - mobile: userData.mobile, - email: userData.email, - address: userData.address, - photo: userData.photo, - documents: { - POI: userData.documents.POI, - POA: userData.documents.POA, - DOB: userData.documents.DOB - } - }, - { - onSuccess: () => { - // setConfirm.mutate({ - // mobile: `+91${userData.mobile}`, - // id: pushUser.data._id - // }) - setPage(page + 1) - } + pushUser.mutate({ + indianResident: userData.indianResident, + name: userData.name, + gender: userData.gender, + dob: userData.dob, + mobile: userData.mobile, + email: userData.email, + address: userData.address, + photo: userData.photo, + documents: { + POI: userData.documents.POI, + POA: userData.documents.POA, + DOB: userData.documents.DOB } - ) + }) } else if (page === 8) { setUserData(initialUserData) navigate('/') |