| @@ -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 | |||
| }); | |||
| } | |||
| } | |||
| } | |||