This commit is contained in:
2018-04-27 21:06:19 -04:00
parent 0e4ceac959
commit 732065c7b5
7 changed files with 208 additions and 94 deletions

View File

@@ -17,11 +17,20 @@ export class UsernameValidator {
return new Promise(resolve => {
this.debouncer = setTimeout(() => {
this.registrationService.validateUserName(control.value).subscribe((res) => {
console.log(res.users.length)
if(res.users.length === 0){
resolve(null);
}else{
resolve({'usernameInUse': true});
}
/*
if(res.ok){
resolve(null);
}
}, (err) => {
resolve({'usernameInUse': true});
*/
});
}, 1000);
});