Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remote validation #95

Open
genpet opened this issue Jun 25, 2022 · 0 comments
Open

remote validation #95

genpet opened this issue Jun 25, 2022 · 0 comments

Comments

@genpet
Copy link

genpet commented Jun 25, 2022

Hi, I am trying to check if the email is already registered or not. I can see the response, and returning true or false. However, no matter what the result is, it does not affect the validation.

ValidatorForm.addValidationRule("isEmailAvailable", (value) => {
const mailformat = /^\w+([.-]?\w+)@\w+([.-]?\w+)(.\w{2,3})+$/;
if (value.match(mailformat)) {
axios
.post(${API_SERVER_URL}/checkEmail, {
email: value,
})
.then(function (response) {
console.log(response.data)
if(response.data === value){
return false;
} else {
return true;
}
})
.catch(function (error) {
console.log(error)
return false;
});
}
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant