| ngOnInit(): void { | ngOnInit(): void { | ||||
| this.loginSub = this.authService.loginSuccess.subscribe( | 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)} | |||||
| ); | ); | ||||
| } | } | ||||
| } | } | ||||
| 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 { | public show(): void { | ||||
| this.notificationService.show({ | this.notificationService.show({ | ||||
| content: 'Your loggin is failed, please try again.', | content: 'Your loggin is failed, please try again.', | ||||
| cssClass: 'button-notification', | cssClass: 'button-notification', | ||||
| animation: { type: 'slide', duration: 400 }, | animation: { type: 'slide', duration: 400 }, | ||||
| position: { horizontal: 'center', vertical: 'bottom' }, | |||||
| position: { horizontal: 'center', vertical: 'top' }, | |||||
| type: { style: 'error', icon: true }, | type: { style: 'error', icon: true }, | ||||
| closable: true | |||||
| hideAfter : 2000 | |||||
| }); | }); | ||||
| } | |||||
| } | |||||
| } | } |