Added email autocomplete on navigate
This commit is contained in:
1 parent
12992c8ae1
commit
7258a59e56
2 files changed
+14
-2
No files matched your search
@@ -3,7 +3,7 @@ import { useTheme } from "@emotion/react";
|
|||||||
import { createToast } from "../../Utils/toastUtils";
|
import { createToast } from "../../Utils/toastUtils";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { forgotPassword } from "../../Features/Auth/authSlice";
|
import { forgotPassword } from "../../Features/Auth/authSlice";
|
||||||
import { useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { credentials } from "../../Validation/validation";
|
import { credentials } from "../../Validation/validation";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import Field from "../../Components/Inputs/Field";
|
import Field from "../../Components/Inputs/Field";
|
||||||
@@ -24,6 +24,11 @@ const ForgotPassword = () => {
|
|||||||
email: "",
|
email: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const email = sessionStorage.getItem("email");
|
||||||
|
email && setForm({ email: sessionStorage.getItem("email") });
|
||||||
|
}, []);
|
||||||
|
|
||||||
const handleSubmit = async (event) => {
|
const handleSubmit = async (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
|||||||
@@ -154,6 +154,13 @@ const StepTwo = ({ form, errors, onSubmit, onChange, onBack }) => {
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const handleNavigate = () => {
|
||||||
|
if (form.email !== "" && !errors.email) {
|
||||||
|
sessionStorage.setItem("email", form.email);
|
||||||
|
}
|
||||||
|
navigate("/forgot-password");
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack gap={theme.gap.large} textAlign="center">
|
<Stack gap={theme.gap.large} textAlign="center">
|
||||||
@@ -209,7 +216,7 @@ const StepTwo = ({ form, errors, onSubmit, onChange, onBack }) => {
|
|||||||
component="span"
|
component="span"
|
||||||
ml={theme.gap.xs}
|
ml={theme.gap.xs}
|
||||||
sx={{ userSelect: "none" }}
|
sx={{ userSelect: "none" }}
|
||||||
onClick={() => navigate("/forgot-password")}
|
onClick={handleNavigate}
|
||||||
>
|
>
|
||||||
Reset password
|
Reset password
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|||||||
Reference in new issue
Block a user