aboutsummaryrefslogtreecommitdiff
path: root/src/app/components/register/register.component.ts
diff options
context:
space:
mode:
authorKamen Mladenov <kamen.d.mladenov@protonmail.com>2021-03-14 09:11:46 +0200
committerGitHub <noreply@github.com>2021-03-14 09:11:46 +0200
commitd2d4452bfa4861458bc0ba6a618c2a27decc8051 (patch)
tree4cb5a0352865cbab3c5ae93141be9b7b2dae53df /src/app/components/register/register.component.ts
parentd8ffe52b67e983b9b317b2e5dcb138ac996eaa31 (diff)
parente3a8875e64c25a6e46380c4d003beac5953fd3e9 (diff)
downloadDevHive-Angular-d2d4452bfa4861458bc0ba6a618c2a27decc8051.tar
DevHive-Angular-d2d4452bfa4861458bc0ba6a618c2a27decc8051.tar.gz
DevHive-Angular-d2d4452bfa4861458bc0ba6a618c2a27decc8051.zip
Merge pull request #1 from Team-Kaleidoscope/code-refactor
Code refactor
Diffstat (limited to 'src/app/components/register/register.component.ts')
-rw-r--r--src/app/components/register/register.component.ts30
1 files changed, 5 insertions, 25 deletions
diff --git a/src/app/components/register/register.component.ts b/src/app/components/register/register.component.ts
index 36eaa55..07b8976 100644
--- a/src/app/components/register/register.component.ts
+++ b/src/app/components/register/register.component.ts
@@ -1,6 +1,6 @@
import { HttpErrorResponse } from '@angular/common/http';
import { Component, OnInit, ViewChild } from '@angular/core';
-import { AbstractControl, FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
+import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { Title } from '@angular/platform-browser';
import { Router } from '@angular/router';
import { TokenService } from 'src/app/services/token.service';
@@ -50,37 +50,17 @@ export class RegisterComponent implements OnInit {
}
onSubmit(): void {
- this._userService.registerUserRequest(this.registerUserFormGroup).subscribe(
- res => {
+ this._userService.registerUserRequest(this.registerUserFormGroup).subscribe({
+ next: (res: object) => {
this._tokenService.setUserTokenToSessionStorage(res);
this._router.navigate(['/']);
},
- (err: HttpErrorResponse) => {
+ error: (err: HttpErrorResponse) => {
this._errorBar.showError(err);
}
- );
+ });
}
onRedirectLogin(): void {
this._router.navigate(['/login']);
}
-
- get firstName(): AbstractControl | null {
- return this.registerUserFormGroup.get('firstName');
- }
-
- get lastName(): AbstractControl | null {
- return this.registerUserFormGroup.get('lastName');
- }
-
- get username(): AbstractControl | null {
- return this.registerUserFormGroup.get('username');
- }
-
- get email(): AbstractControl | null {
- return this.registerUserFormGroup.get('email');
- }
-
- get password(): AbstractControl | null {
- return this.registerUserFormGroup.get('password');
- }
}