Skip to content

Instantly share code, notes, and snippets.

@sygn
Created May 11, 2020 21:46
Show Gist options
  • Save sygn/2b13d95d845b9e4ec2239a87c90d73e3 to your computer and use it in GitHub Desktop.
Save sygn/2b13d95d845b9e4ec2239a87c90d73e3 to your computer and use it in GitHub Desktop.
async form validation
// email validation
// .test('checkDuplUsername', 'same name exists', function (value) {
// return new Promise((resolve, reject) => {
// kn.http({
// url: `/v1/api/${value}`,
// method: 'head',
// }).then(() => {
// // exists
// resolve(false)
// }).catch(() => {
// // note exists
// resolve(true)
// })
// })
// })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment