Merge pull request #386 from bluewave-labs/fix/register-bug
Fix refactoring bug, shadowing variable
This commit is contained in:
1 file changed
+4
-4
@@ -42,8 +42,8 @@ const Register = ({ isAdmin }) => {
|
|||||||
const handleSubmit = async (e) => {
|
const handleSubmit = async (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const form = { ...form, role: isAdmin ? "admin" : "user" };
|
const registerForm = { ...form, role: isAdmin ? "admin" : "user" };
|
||||||
const { error } = credentials.validate(form, {
|
const { error } = credentials.validate(registerForm, {
|
||||||
abortEarly: false,
|
abortEarly: false,
|
||||||
context: { password: form.password },
|
context: { password: form.password },
|
||||||
});
|
});
|
||||||
@@ -62,8 +62,8 @@ const Register = ({ isAdmin }) => {
|
|||||||
: "Error validating data.",
|
: "Error validating data.",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
delete form.confirm;
|
delete registerForm.confirm;
|
||||||
const action = await dispatch(register(form));
|
const action = await dispatch(register(registerForm));
|
||||||
if (action.payload.success) {
|
if (action.payload.success) {
|
||||||
const token = action.payload.data;
|
const token = action.payload.data;
|
||||||
localStorage.setItem("token", token);
|
localStorage.setItem("token", token);
|
||||||
|
|||||||
Reference in new issue
Block a user