diff --git a/src/app/auth/auth.component.ts b/src/app/auth/auth.component.ts index 8e9a548..3c793dd 100644 --- a/src/app/auth/auth.component.ts +++ b/src/app/auth/auth.component.ts @@ -24,14 +24,7 @@ export class AuthComponent implements OnInit, OnDestroy{ ngOnInit(): void { this.loginSub = this.authService.loginSuccess.subscribe( - (ok :boolean ) =>{ - this.loading = false - console.log (" found login success " + ok ); - if (ok) - this.rounter.navigate(["/dashboard"]); - else - this.show(); - } + (ok:boolean) =>{this.onLogin(ok)} ); } @@ -46,15 +39,23 @@ export class AuthComponent implements OnInit, OnDestroy{ } + public onLogin(ok:boolean) { + this.loading = false + console.log (" found login success " + ok ); + if (ok) + this.rounter.navigate(["/dashboard"]); + else + this.show(); + } public show(): void { this.notificationService.show({ content: 'Your loggin is failed, please try again.', cssClass: 'button-notification', animation: { type: 'slide', duration: 400 }, - position: { horizontal: 'center', vertical: 'bottom' }, + position: { horizontal: 'center', vertical: 'top' }, type: { style: 'error', icon: true }, - closable: true + hideAfter : 2000 }); -} + } }