Skip to content

Commit

Permalink
email verifier added
Browse files Browse the repository at this point in the history
  • Loading branch information
ALOK9442 committed Jan 9, 2024
1 parent 583dfa0 commit b3138e5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/components/authcomponents/emailverifier.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import axios from 'axios';
import React, { useEffect, useState } from 'react'
import { useNavigate } from 'react-router-dom';
import { verifyEmail } from '../../services/auth/authservice';
function EmailVerifier() {
const navigate = useNavigate()
const [verificationText, setVerificationText] = useState("Cryptbee is verifying you...")
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState("");

useEffect(() => {
const fetchData = async () => {
Expand All @@ -17,24 +19,19 @@ function EmailVerifier() {
const onapp = params.get('onapp')
console.log(onapp)
console.log(`${queryString}, ${params},${email},${id} `)
const response = await axios.post('https://cryptbee.anshumannandan.tech/auth/verifyemailLINK/', {
const response = await verifyEmail(
id,
email,
onapp,
},
{
headers: {
"Content-Type": "application/json",
},
}
)
console.log(response)
// if (response.status === 200){
// setVerificationText("You Have Been Successfully Verified. Open The Website To Enjoy The Services")
// console.log(response.data)
// // dispatch()
// // navigate('/verify-pan')
// }else {
if (response.status === 200){
setVerificationText("You Have Been Successfully Verified. Open The Website To Enjoy The Services")
console.log(response.data)
// dispatch()
navigate('/')
}
// else {
// let showcase;
// if(response.data.message[0] !=null) showcase = response.data.message[0]
// else if(response.data.UUID != null) showcase = response.data.UUID[0]
Expand All @@ -44,6 +41,7 @@ function EmailVerifier() {
} catch (error) {
console.log(error)
setVerificationText(error.message)
setIsLoading(false)
} finally {
setIsLoading(false)
}
Expand Down
20 changes: 20 additions & 0 deletions src/services/auth/authservice.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,26 @@ export const verifyPan = async ({email, name, pan}) => {
}
}

export const verifyEmail = async (id,email,onapp) => {
try {
console.log("trying to verify email")
const response = await axios.post(BASEURL + config.verificationCheckerLink, {
id,email,onapp
},
{
headers: {
'content-type': 'application/json'
},
}
)
console.log(response.data)
return response;
} catch (error) {
console.log(error)
throw (error)
}
}

export const forgotpassword = async ({ email, otp, password }) => {
try {
const response = await axios.patch(BASEURL + config.resetPassLink, {
Expand Down

0 comments on commit b3138e5

Please sign in to comment.