import React, { useRef, useState } from "react"; import { RiLockPasswordFill } from "react-icons/ri"; import { Link, useNavigate, useParams } from "react-router-dom"; import { FaArrowLeft } from "react-icons/fa6"; import { BACKEND_URL } from "../../constants"; const ResetPassword = () => { const [secure, setSecure] = useState(true); const newPassworElement = useRef(); const confirmPassworElement = useRef(); const navigate = useNavigate(); const { token } = useParams(); // console.log("So our Token is : ", token); const handleResetPassword = async (event) => { event.preventDefault(); if ( confirmPassworElement.current.value !== newPassworElement.current.value ) { setSecure(false); } else { const responce = await fetch( `${BACKEND_URL}/api/v1/password/reset/${token}`, { method: "PUT", credentials: "include", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ password: newPassworElement.current.value, confirmPassword: confirmPassworElement.current.value, }), } ); const data = await responce.json(); //console.log("Status of the Reset password", data); if (data.success === true) { navigate("/user/login"); } } }; return ( <>

Create New Password

Create your new, unique and secure password here.

Password and confirm Password is not same.Please Enter new password and confirm Password same

Back to Login Page
); }; export default ResetPassword;