|
|
|
@@ -21,14 +21,7 @@ var AuthComponent = /** @class */ (function () { |
|
|
|
} |
|
|
|
AuthComponent.prototype.ngOnInit = function () { |
|
|
|
var _this = this; |
|
|
|
this.loginSub = this.authService.loginSuccess.subscribe(function (ok) { |
|
|
|
_this.loading = false; |
|
|
|
console.log(" found login success " + ok); |
|
|
|
if (ok) |
|
|
|
_this.rounter.navigate(["/dashboard"]); |
|
|
|
else |
|
|
|
_this.show(); |
|
|
|
}); |
|
|
|
this.loginSub = this.authService.loginSuccess.subscribe(function (ok) { _this.onLogin(ok); }); |
|
|
|
}; |
|
|
|
AuthComponent.prototype.ngOnDestroy = function () { |
|
|
|
this.loginSub.unsubscribe(); |
|
|
|
@@ -38,14 +31,22 @@ var AuthComponent = /** @class */ (function () { |
|
|
|
this.loading = true; |
|
|
|
this.authService.login(this.userForm.value.email, this.userForm.value.password); |
|
|
|
}; |
|
|
|
AuthComponent.prototype.onLogin = function (ok) { |
|
|
|
this.loading = false; |
|
|
|
console.log(" found login success " + ok); |
|
|
|
if (ok) |
|
|
|
this.rounter.navigate(["/dashboard"]); |
|
|
|
else |
|
|
|
this.show(); |
|
|
|
}; |
|
|
|
AuthComponent.prototype.show = function () { |
|
|
|
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 |
|
|
|
}); |
|
|
|
}; |
|
|
|
AuthComponent = __decorate([ |