diff --git a/src/components/AuthPages/ForgotPassword/index.jsx b/src/components/AuthPages/ForgotPassword/index.jsx
index 0eabcec..8bf29a2 100644
--- a/src/components/AuthPages/ForgotPassword/index.jsx
+++ b/src/components/AuthPages/ForgotPassword/index.jsx
@@ -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() {
@@ -144,12 +147,6 @@ export default function ForgotPassword() {
Cancel
- {/*
- Send Code
- */}
diff --git a/src/components/AuthPages/SignUp/index.jsx b/src/components/AuthPages/SignUp/index.jsx
index b01e81e..ee8732d 100644
--- a/src/components/AuthPages/SignUp/index.jsx
+++ b/src/components/AuthPages/SignUp/index.jsx
@@ -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)