fix: async validator (#3194)

This commit is contained in:
bowen
2023-10-26 11:54:09 +08:00
committed by GitHub
parent 4755017bcc
commit 405ef9e2b3
2 changed files with 6 additions and 2 deletions

View File

@@ -192,10 +192,12 @@
message: '请输入数据',
},
{
trigger: 'blur',
validator(_, value) {
return new Promise((resolve, reject) => {
if (!value) return resolve();
isAccountExist(value)
.then(() => resolve())
.then(resolve)
.catch((err) => {
reject(err.message || '验证失败');
});

View File

@@ -89,10 +89,12 @@ export const accountFormSchema: FormSchema[] = [
message: '请输入用户名',
},
{
trigger: 'blur',
validator(_, value) {
return new Promise((resolve, reject) => {
if (!value) return resolve();
isAccountExist(value)
.then(() => resolve())
.then(resolve)
.catch((err) => {
reject(err.message || '验证失败');
});