Skip to content

Commit

Permalink
Merge pull request #17 from jonigl/improvements
Browse files Browse the repository at this point in the history
user already exist message added.
  • Loading branch information
jonigl committed Oct 23, 2018
2 parents 3daf815 + d327668 commit 4fb4045
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/app/registration/registration.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,21 @@ export class RegistrationComponent implements OnInit {
onSubmit() {
if (this.registrationForm.valid) {
this.spinner.show();
this.userService.create(this.getUser()).pipe(first()).subscribe(response => {
this.spinner.hide();
this.snackbar.open('Successfully registered user!', '', { duration: 1000 });
setTimeout(() => {
this.router.navigate(['login']);
}, 3000);
});
this.userService
.create(this.getUser())
.pipe(first())
.subscribe(
response => {
this.spinner.hide();
this.snackbar.open('Successfully registered user!', '', { duration: 1000 });
setTimeout(() => {
this.router.navigate(['login']);
}, 3000);
},
error => {
this.snackbar.open('User already exist!', '', { duration: 1000 });
}
);
}
}

Expand Down

0 comments on commit 4fb4045

Please sign in to comment.