From 795b17e486fd04dcc721606b8ed1322d5fc4a771 Mon Sep 17 00:00:00 2001 From: Aamir S <40729965+AamirL1011@users.noreply.github.com> Date: Wed, 31 Mar 2021 14:59:33 -0700 Subject: [PATCH] Removed redundant formType state property --- src/Components/Authentication/Login.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/Components/Authentication/Login.js b/src/Components/Authentication/Login.js index e37d744..86e9dd3 100644 --- a/src/Components/Authentication/Login.js +++ b/src/Components/Authentication/Login.js @@ -7,7 +7,7 @@ import "./Login.css"; const initialFormState = { - email: "", password: "", authCode: "", resetCode: "", formType: "signIn" + email: "", password: "", authCode: "", resetCode: "" } function Login(props) { @@ -19,9 +19,6 @@ function Login(props) { const [newVerification, setNewVerification] = useState(false); const [loading, setLoading] = useState(false); - useEffect(() => { - updateFormState(() => ({...formState, formType: loginState})); - }, [loginState]) useEffect(() => { async function retrieveUser() { @@ -48,7 +45,6 @@ function Login(props) { updateFormState(() => ({...formState, [e.target.name]: e.target.value})) } - const {formType} = formState; async function signUp() { try { @@ -169,14 +165,14 @@ function Login(props) {
- {(formType === "signIn")? Sign In : (formType === "signUp")? Sign Up : (formType === "confirmSignUp")? Verify Account : (formType === "forgotPassword" || formType === "resetPassword")? Password Reset : Welcome} + {(loginState === "signIn")? Sign In : (loginState === "signUp")? Sign Up : (loginState === "confirmSignUp")? Verify Account : (loginState === "forgotPassword" || loginState === "resetPassword")? Password Reset : Welcome}
{ - formType === "signIn" && ( + loginState === "signIn" && ( @@ -237,7 +233,7 @@ function Login(props) { ) } { - formType === "forgotPassword" && ( + loginState === "forgotPassword" && ( @@ -270,7 +266,7 @@ function Login(props) { ) } { - formType === "resetPassword" && ( + loginState === "resetPassword" && ( @@ -319,7 +315,7 @@ function Login(props) { ) } { - formType === "signUp" && ( + loginState === "signUp" && ( @@ -362,7 +358,7 @@ function Login(props) { ) } { - formType === "confirmSignUp" && ( + loginState === "confirmSignUp" && (