Open genpet opened 2 years ago
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; }); } });
${API_SERVER_URL}/checkEmail
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; }); } });