Skip to content

Commit

Permalink
Fix variable name conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
mhauru committed May 17, 2022
1 parent fe854aa commit 5759ef5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions frontend/src/components/Signup.js
Expand Up @@ -55,14 +55,16 @@ const Signup = () => {
setPassword2("");
localStorage.clear();
setErrors(true);
let errors = [];
if (data.email) errors = [...errors, ...data.email];
if (data.password1) errors = [...errors, ...data.password1];
if (data.password2) errors = [...errors, ...data.password2];
let currentErrors = [];
if (data.email) currentErrors = [...currentErrors, ...data.email];
if (data.password1)
currentErrors = [...currentErrors, ...data.password1];
if (data.password2)
currentErrors = [...currentErrors, ...data.password2];
if (data.non_field_errors)
errors = [...errors, ...data.non_field_errors];
setErrorMessages(errors);
console.log("Errors are", errors);
currentErrors = [...currentErrors, ...data.non_field_errors];
setErrorMessages(currentErrors);
console.log("Errors are", currentErrors);
}
});
};
Expand Down

0 comments on commit 5759ef5

Please sign in to comment.