added registration functionality to RegisterComponent

This commit is contained in:
2020-07-21 15:24:25 +02:00
parent c0612696c9
commit 23e687de27

View File

@@ -45,10 +45,21 @@ export class RegisterComponent implements OnInit {
}
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 { }
}