I am getting a mail through url it is encrypted, i passed the mail on the api but since it is encrypted the api is sending bad request. The back end is dot net and they used Utf8Encoding to encrypt the mail. React is the front end and i used crypto.js to decrypt the mail but its not working. Can anyone help me out on this. this is my code
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const email = urlParams.get("email");
const code = urlParams.get("code");
useEffect(() => {});
const handleSubmit = (event) => {
debugger;
event.preventDefault();
const data = new FormData(event.currentTarget);
ResetPasswordServices.resetpassword(
email,
newpassword,
confirmPassword,
code
)
.then((res) => {
if (res?.status == "200") {
setAlertMessage("Password has been successfully reset.");
setTimeout(() => {
console.log("Timeout complete");
setAlertMessage("");
window.location.href = "/";
}, 3000);
} else if (res?.status == "400") {
setErrorMessage("Failed to change password.");
setTimeout(() => {
setErrorMessage("");
}, 3000);
}
})
.catch((error) => {
console, log("failed", error);
setErrorMessage("Failed to send mail.");
setTimeout(() => {
setErrorMessage("");
}, 3000);
// Error - display error message
console.error(error);
});
};