Website Summary Files Commits Branches @commit @diff @stats
path: root / src / app / components / login
diff options
context:
space:
mode:
Commitd2d4452bfa4861458bc0ba6a618c2a27decc8051 (patch)
Author
 Kamen Mladenov <kamen.d.mladenov@protonmail.com>
2021-03-14 09:11:46 +0200
Committer
 GitHub <noreply@github.com>
2021-03-14 09:11:46 +0200
Files4cb5a0352865cbab3c5ae93141be9b7b2dae53df /src/app/components/login
DevHive-Angular-d2d4452bfa4861458bc0ba6a618c2a27decc8051.tar
DevHive-Angular-d2d4452bfa4861458bc0ba6a618c2a27decc8051.tar.gz
DevHive-Angular-d2d4452bfa4861458bc0ba6a618c2a27decc8051.zip
Parentd8ffe52b67e983b9b317b2e5dcb138ac996eaa31 (diff)
Parente3a8875e64c25a6e46380c4d003beac5953fd3e9 (diff)
Merge pull request #1 from Team-Kaleidoscope/code-refactor
Code refactor
1 files changed, 5 insertions, 13 deletions
-rw-r--r--src/app/components/login/login.component.ts18
diff --git a/src/app/components/login/login.component.ts b/src/app/components/login/login.component.ts
index c3fb79c..edbc461 100644
--- a/src/app/components/login/login.component.ts
+++ b/src/app/components/login/login.component.ts
@@ -1,5 +1,5 @@
import { Component, OnInit, ViewChild } from '@angular/core';
-import { FormGroup, FormBuilder, Validators, FormControl, AbstractControl } from '@angular/forms';
+import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms';
import { Router } from '@angular/router';
import { Title } from '@angular/platform-browser';
import { UserService } from 'src/app/services/user.service';
@@ -34,26 +34,18 @@ export class LoginComponent implements OnInit {
onSubmit(): void {
this._errorBar.hideError();
- this._userService.loginUserRequest(this.loginUserFormGroup).subscribe(
- (res: object) => {
+ this._userService.loginUserRequest(this.loginUserFormGroup).subscribe({
+ next: (res: object) => {
this._tokenService.setUserTokenToSessionStorage(res);
this._router.navigate(['/']);
},
- (err: HttpErrorResponse) => {
+ error: (err: HttpErrorResponse) => {
this._errorBar.showError(err);
}
- );
+ });
}
onRedirectRegister(): void {
this._router.navigate(['/register']);
}
-
- get username(): AbstractControl | null {
- return this.loginUserFormGroup.get('username');
- }
-
- get password(): AbstractControl | null {
- return this.loginUserFormGroup.get('password');
- }
}