|
|
|
@ -11,6 +11,7 @@ import { useDispatch, useSelector } from "react-redux"; |
|
|
|
|
import { Alert } from "../../../_components/Alert"; |
|
|
|
|
import { userConstants } from "../../../_constants"; |
|
|
|
|
import { alertActions } from "../../../_actions"; |
|
|
|
|
import { isEmail } from "../../../_helpers/validateEmail"; |
|
|
|
|
|
|
|
|
|
const CreateAccount = () => { |
|
|
|
|
const params = new URL(document.location).searchParams; |
|
|
|
@ -63,6 +64,12 @@ const CreateAccount = () => { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const checkEmail = () => { |
|
|
|
|
if (!isEmail(email)) { |
|
|
|
|
setEmailError("Định dạng email không đúng"); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const checkPw = () => { |
|
|
|
|
if (password.length < 6 || password.trim() === "") { |
|
|
|
|
setPwError("Mật khẩu cần tối thiểu 6 kí tự và không gồm toàn dấu cách"); |
|
|
|
@ -135,9 +142,9 @@ const CreateAccount = () => { |
|
|
|
|
const onBlurField = (type) => { |
|
|
|
|
switch (type) { |
|
|
|
|
case "email": { |
|
|
|
|
// if (email && !emailError) {
|
|
|
|
|
// checkEmail();
|
|
|
|
|
// }
|
|
|
|
|
if (email && !emailError) { |
|
|
|
|
checkEmail(); |
|
|
|
|
} |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
case "password": { |
|
|
|
|