everything works!
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import WrenchBoard from "../../../assets/images/wrenchboard.png"
|
||||
import InputCom from "../../Helpers/Inputs/InputCom";
|
||||
@@ -26,10 +26,10 @@ export default function ForgotPassword() {
|
||||
const resetHandler = async () => {
|
||||
if (email == '') {
|
||||
setMsgError('Please fill in fields')
|
||||
} else if (!checked){
|
||||
} else if (!checked) {
|
||||
setMsgError('Check if you are human')
|
||||
}
|
||||
|
||||
|
||||
if (email != '' && checked) {
|
||||
const reqData = { email }
|
||||
setResetLoading(true)
|
||||
@@ -44,11 +44,14 @@ export default function ForgotPassword() {
|
||||
}
|
||||
if (data.status > 0) {
|
||||
setResetLoading(false)
|
||||
navigate("/verify-you", { replace: true })
|
||||
console.log('Success', data)
|
||||
}
|
||||
setMail("")
|
||||
}
|
||||
} catch (error) {
|
||||
setResetLoading(false)
|
||||
setMail("")
|
||||
setMsgError('An error occurred')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
@@ -105,7 +108,7 @@ export default function ForgotPassword() {
|
||||
<div className="relative table top-0 h-full">
|
||||
<div className="table-cell align-middle">
|
||||
<div className="relative w-[30px] h-[30px] mx-[15px]">
|
||||
<input type="checkbox" name="human-checkbox" id="human-checkbox" className="w-[28px] h-[28px] border-[1px] rounded border-gray-400 checked:bg-white" />
|
||||
<input type="checkbox" name="human-checkbox" id="human-checkbox" className="w-[28px] h-[28px] border-[1px] rounded border-gray-400 checked:bg-white" onClick={humanChecker} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -144,12 +147,6 @@ export default function ForgotPassword() {
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
{/* <a
|
||||
href="/verify-you"
|
||||
className="w-full rounded-[50px] mb-5 h-[58px] text-xl text-white font-bold flex justify-center bg-purple items-center"
|
||||
>
|
||||
Send Code
|
||||
</a> */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -29,14 +29,15 @@ export default function SignUp() {
|
||||
// To Show and Hide Password
|
||||
const togglePasswordVisibility = () => {
|
||||
setShowPassword(!showPassword);
|
||||
// return console.log('showPassword')
|
||||
};
|
||||
|
||||
const rememberMe = () => {
|
||||
setValue(!checked);
|
||||
};
|
||||
|
||||
const navigate = useNavigate();
|
||||
const userApi = new usersService();
|
||||
|
||||
// Get Country Api
|
||||
const getCountryList = async () => {
|
||||
const res = await userApi.getSignupCountryData()
|
||||
@@ -74,27 +75,32 @@ export default function SignUp() {
|
||||
}
|
||||
|
||||
const res = await userApi.CreateUser(reqData)
|
||||
setSignUpLoading(true)
|
||||
|
||||
if (res.status === 200) {
|
||||
const { data } = res
|
||||
if (data.status == -1 && data.acc == 'DULPICATE') {
|
||||
setMsgError('This account has been already created')
|
||||
setSignUpLoading(false)
|
||||
}
|
||||
if (data.status > 0 && data.internal_return == 100 && data.session != '') {
|
||||
localStorage.setItem("email", `${data.email}`);
|
||||
localStorage.setItem("country", `${data.country}`);
|
||||
localStorage.setItem("firstname", `${data.firstname}`);
|
||||
localStorage.setItem("lastname", `${data.lastname}`);
|
||||
setSignUpLoading(true)
|
||||
|
||||
setTimeout(() => {
|
||||
navigate("/", { replace: true });
|
||||
setSignUpLoading(false)
|
||||
}, 2000)
|
||||
console.log('Success')
|
||||
} else {
|
||||
setMsgError(data.status)
|
||||
setSignUpLoading(false)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setMsgError('This account does not exist')
|
||||
setSignUpLoading(false)
|
||||
}
|
||||
} catch (error) {
|
||||
throw new Error(error)
|
||||
|
||||
Reference in New Issue
Block a user