diff --git a/package.json b/package.json index 9a1e775..0a9c147 100644 --- a/package.json +++ b/package.json @@ -13,18 +13,19 @@ "license": "MIT", "author": "The CoreUI Team (https://github.com/orgs/coreui/people)", "scripts": { - "dev": "react-scripts start", - "build": "react-scripts --openssl-legacy-provider build", - "changelog": "auto-changelog --starting-version 4.1.0 --commit-limit false --hide-credit", - "eject": "react-scripts eject", - "lint": "eslint \"src/**/*.js\"", - "start": "serve -s build", - "start:n17": "react-scripts --openssl-legacy-provider start", - "test": "react-scripts test", - "test:cov": "npm test -- --coverage --watchAll=false", - "test:debug": "react-scripts --inspect-brk test --runInBand", - "heroku-postbuild": "npm run build" - }, + "dev": "cross-env NODE_OPTIONS=--openssl-legacy-provider react-scripts start", + "build": "cross-env NODE_OPTIONS=--openssl-legacy-provider react-scripts build", + "changelog": "auto-changelog --starting-version 4.1.0 --commit-limit false --hide-credit", + "eject": "react-scripts eject", + "lint": "eslint \"src/**/*.js\"", + "start": "serve -s build", + "start:n17": "react-scripts --openssl-legacy-provider start", + "test": "react-scripts test", + "test:cov": "npm test -- --coverage --watchAll=false", + "test:debug": "react-scripts --inspect-brk test --runInBand", + "heroku-postbuild": "npm run build" +} +, "config": { "coreui_library_short_version": "4.1" }, @@ -86,6 +87,7 @@ }, "devDependencies": { "auto-changelog": "~2.3.0", + "cross-env": "^7.0.3", "fuse.js": "^6.6.2", "react-scripts": "^4.0.3", "sass": "^1.43.5" diff --git a/src/App.js b/src/App.js index e33722b..c9401d0 100644 --- a/src/App.js +++ b/src/App.js @@ -199,6 +199,7 @@ import { isAutheticated } from "./auth"; import "./scss/style.scss"; import ProtectedRoute from "./components/ProtectedRoute"; import axios from "axios"; +import ForgotPassword from "./views/pages/register/ForgotPassword"; // Containers const DefaultLayout = React.lazy(() => import("./layout/DefaultLayout")); @@ -254,6 +255,8 @@ const App = () => { {/* } /> */} } /> + } /> + } /> } /> { // axios.defaults.baseURL = "http://localhost:5000"; + //Old render deploy // axios.defaults.baseURL = "https://cheminova-api-2.onrender.com"; + //latest render deploy + //axios.defaults.baseURL = "https://cheminova-api1.onrender.com" axios.defaults.baseURL = "https://api.cnapp.co.in"; axios.defaults.headers = { diff --git a/src/routes.js b/src/routes.js index d39bec1..0349cbf 100644 --- a/src/routes.js +++ b/src/routes.js @@ -179,6 +179,7 @@ import DistributorLiqudations from "./views/PrincipalDistributors/DistributorLiq import UpdatePrincipalDistributor from "./views/PrincipalDistributors/updateprincipaldistributor"; import RDViewOrder from "./views/RetailerOrders/ViewOrder"; import RetailerOrder from "./views/RetailerOrders/RetailerOrder"; +import ForgotPassword from "./views/pages/register/ForgotPassword"; const routes = [ //dashboard @@ -189,6 +190,12 @@ const routes = [ element: Change_Password, navName: "", }, + { + path: "/forgot/password", + name: "Forgot Password", + element: ForgotPassword, + navName: "", + }, { path: "/profile/edit", name: "Edit Profile", diff --git a/src/views/pages/login/Login.js b/src/views/pages/login/Login.js index 944905b..12efe98 100644 --- a/src/views/pages/login/Login.js +++ b/src/views/pages/login/Login.js @@ -202,9 +202,11 @@ const Login = () => {
- {/* - Forgot password.? - */} + + + Forgot password.? + + {/* diff --git a/src/views/pages/register/ForgotPassword.js b/src/views/pages/register/ForgotPassword.js index 0aecbcd..4ce8a1c 100644 --- a/src/views/pages/register/ForgotPassword.js +++ b/src/views/pages/register/ForgotPassword.js @@ -30,17 +30,19 @@ const ForgotPassword = () => { try { setLoading(true) - const res = await axios.post(`/api/v1/user/password/forgot`, { email: email }) + const res = await axios.post(`https://cheminova-api1.onrender.com/api/v1/user/password/forgot`, { email: email }) // console.log(res); if (res.data.success === true) { setLoading(false) // alert("Email Send Successfully! please check your mail for reset password") - swal("success!", "Email Send Successfully! please check your Email for new password", "success"); + swal("success!", "'Password sent to your email Successfully!", "success"); navigate("/"); } - } catch (e) { - swal('Error!', 'Wrong Email ID. Enter valid email to get the password', 'error') + } catch (error) { + const errorMessage = error?.response?.data?.message || 'Something went wrong!'; + swal('Error!', errorMessage, 'error'); + // swal('Error!', 'Wrong Email ID. Enter valid email to get the password', 'error') setLoading(false) @@ -52,49 +54,53 @@ const ForgotPassword = () => { } - return
- - - - - - -

Forgot Password?

-

Enter your email Below, we will send you password in your Email

- {/* + return ( +
+ + + + + + +

Forgot Password?

+

Enter your email Below, we will send you password in your Email

+ {/* */} - - - - - setEmail(e.target.value)} - /> - + + + + + setEmail(e.target.value)} + /> + - handleSubmit()}> - - {!loading && "Send"} - - - Back to Login - -
-
-
-
-
-
-
; + handleSubmit()}> + + {!loading && "Send"} + + + Back to Login + +
+
+
+
+
+
+
) }; export default ForgotPassword;