+
- Not a Member yet?
Register
+ Not a Member yet?
Register
\ No newline at end of file
diff --git a/src/UI/src/app/modules/auth/pages/login/login.component.spec.ts b/src/UI/src/app/modules/auth/pages/login/login.component.spec.ts
index 31e6251..fd1ca62 100644
--- a/src/UI/src/app/modules/auth/pages/login/login.component.spec.ts
+++ b/src/UI/src/app/modules/auth/pages/login/login.component.spec.ts
@@ -5,6 +5,7 @@ import { HttpClientModule } from '@angular/common/http';
import { RouterTestingModule } from '@angular/router/testing';
import { ReactiveFormsModule } from '@angular/forms';
import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { ToastrModule } from 'ngx-toastr';
describe('LoginComponent', () => {
let component: LoginComponent;
@@ -18,6 +19,7 @@ describe('LoginComponent', () => {
RouterTestingModule,
ReactiveFormsModule,
HttpClientTestingModule,
+ ToastrModule.forRoot()
],
});
fixture = TestBed.createComponent(LoginComponent);
diff --git a/src/UI/src/app/modules/auth/pages/login/login.component.ts b/src/UI/src/app/modules/auth/pages/login/login.component.ts
index 0e2c7c1..3be4c27 100644
--- a/src/UI/src/app/modules/auth/pages/login/login.component.ts
+++ b/src/UI/src/app/modules/auth/pages/login/login.component.ts
@@ -5,15 +5,9 @@ import { Router, RouterLink } from '@angular/router';
import { Subscription, timer } from 'rxjs';
import { AuthService } from 'src/app/core/auth/service/auth.service';
import { HttpClient, HttpClientModule } from '@angular/common/http';
+import { ToastrService } from 'ngx-toastr';
-enum LocalLoginState {
- None,
- Waiting,
- Success,
- ErrorWrongData,
- ErrorOther
-}
@Component({
selector: 'app-login',
@@ -26,7 +20,7 @@ enum LocalLoginState {
NgClass,
NgIf,
],
- providers: [AuthService,HttpClient],
+ providers: [HttpClient],
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss']
})
@@ -34,29 +28,22 @@ export class LoginComponent implements OnInit, OnDestroy{
form!: FormGroup;
submitted = false;
passwordTextType!: boolean;
- formSubmitAttempt: boolean;
private sub: Subscription;
- constructor(private readonly _formBuilder: FormBuilder, private _router: Router,private authService: AuthService) {}
+ constructor(private readonly _formBuilder: FormBuilder, private _router: Router,private authService: AuthService, private toastr: ToastrService) {}
-
ngOnInit(): void {
this.form = this._formBuilder.group({
- email: ['test3@gmail.com', [Validators.required, Validators.email]],
- password: ['Admin1!', Validators.required],
+ email: ['', [Validators.required, Validators.email]],
+ password: ['', Validators.required],
});
}
-
ngOnDestroy(): void {
if(this.sub) this.sub.unsubscribe();
}
-
- localLoginState = LocalLoginState.None;
- get localLoginStates() { return LocalLoginState; }
-
get f() {
return this.form.controls;
}
@@ -79,8 +66,9 @@ export class LoginComponent implements OnInit, OnDestroy{
this._router.navigate(['/dashboard']);
},
error: (err: any) => {
+ this.toastr.error(JSON.stringify(err));
// Handle errors here
- // 401
+ // 4013
// display alert
}
});
diff --git a/src/UI/src/app/modules/auth/pages/register/register.component.html b/src/UI/src/app/modules/auth/pages/register/register.component.html
index 4edba02..9ab30ab 100644
--- a/src/UI/src/app/modules/auth/pages/register/register.component.html
+++ b/src/UI/src/app/modules/auth/pages/register/register.component.html
@@ -1,4 +1,4 @@
-