added registration functionality to RegisterComponent
This commit is contained in:
@@ -45,10 +45,21 @@ export class RegisterComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onRegister() {
|
onRegister() {
|
||||||
this.loading = !this.loading;
|
if (this.form.invalid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.loading = true;
|
||||||
|
this.accountService.register(this.readForm())
|
||||||
|
.pipe(first())
|
||||||
|
.subscribe(data => {
|
||||||
|
this.router.navigate(['/login']);
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
// TODO error handling
|
||||||
|
console.log(error);
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor() { }
|
|
||||||
|
|
||||||
ngOnInit(): void { }
|
ngOnInit(): void { }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user