Last active
October 26, 2017 12:37
-
-
Save skomarfaruque/0b362c50e275c77bde43ce07f6b0bfff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v-validate="{ rules: { required: true, regex: /\b(0[1-9]|1[0-2])\/?([0-9]{4}|[0-9]{2})\b/} }" //inline regex | |
custom: | |
this.$validator.extend('emailexists', { // checks if the email is already in db | |
getMessage: field => 'Your email is in our record.Please check your email to login', | |
validate: async value => { | |
let response = await fetch(`${process.env.baseUrl}/users/auth/searchbyquery?email=${value}`, { | |
method: 'GET', | |
headers: {'Content-Type': 'Application/json'} | |
}) | |
let result = await response.json() | |
if (result.success && result.data) { | |
return false | |
} else { | |
return true | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment