From 4d6c20bf9d83fb6601c45dc68d5451a9541ee6a8 Mon Sep 17 00:00:00 2001 From: leejinho Date: Wed, 25 Mar 2020 09:23:56 +0900 Subject: [PATCH] =?UTF-8?q?bugfix=20=EB=84=A4=ED=8A=B8=EC=9B=8C=ED=81=AC?= =?UTF-8?q?=20=EC=A0=88=EC=B2=B4=EC=8B=9C=20=EB=B0=9C=EC=83=9D=ED=95=98?= =?UTF-8?q?=EB=8A=94=20Alert=20=ED=8C=9D=EC=97=85=20ngZone=20=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=9E=A9=ED=95=91.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/login.page.component.ts | 46 ++++++++++--------- .../store/account/authentication/effects.ts | 37 +++++++-------- 2 files changed, 44 insertions(+), 39 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.ts b/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.ts index 318d7252..16c265c7 100644 --- a/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.ts +++ b/projects/ucap-webmessenger-app/src/app/pages/account/components/login.page.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, OnDestroy, Inject } from '@angular/core'; +import { Component, OnInit, OnDestroy, Inject, NgZone } from '@angular/core'; import { Store, select } from '@ngrx/store'; @@ -92,7 +92,8 @@ export class LoginPageComponent implements OnInit, OnDestroy { private localStorageService: LocalStorageService, private sessionStorageService: SessionStorageService, private externalApiService: ExternalApiService, - private appAuthenticationService: AppAuthenticationService + private appAuthenticationService: AppAuthenticationService, + private ngZone: NgZone ) { this.useRememberMe = environment.productConfig.authentication.rememberMe.use; @@ -317,6 +318,28 @@ export class LoginPageComponent implements OnInit, OnDestroy { // Recursion function > onLogin this.onLogin(value); } else { + this.ngZone.run(() => { + this.dialogService.open< + AlertDialogComponent, + AlertDialogData, + AlertDialogResult + >(AlertDialogComponent, { + width: '360px', + data: { + title: this.translateService.instant( + 'accounts.errors.loginFailed' + ), + html: this.translateService.instant( + 'accounts.errors.networkFailedAndRetry' + ) + } + }); + this.loginBtnEnable = true; + }); + } + }), + catchError(error => { + this.ngZone.run(() => { this.dialogService.open< AlertDialogComponent, AlertDialogData, @@ -333,26 +356,7 @@ export class LoginPageComponent implements OnInit, OnDestroy { } }); this.loginBtnEnable = true; - } - }), - catchError(error => { - this.dialogService.open< - AlertDialogComponent, - AlertDialogData, - AlertDialogResult - >(AlertDialogComponent, { - width: '360px', - data: { - title: this.translateService.instant( - 'accounts.errors.loginFailed' - ), - html: this.translateService.instant( - 'accounts.errors.networkFailedAndRetry' - ) - } }); - this.loginBtnEnable = true; - return of(); }) ) diff --git a/projects/ucap-webmessenger-app/src/app/store/account/authentication/effects.ts b/projects/ucap-webmessenger-app/src/app/store/account/authentication/effects.ts index 571a1f66..6189e44f 100644 --- a/projects/ucap-webmessenger-app/src/app/store/account/authentication/effects.ts +++ b/projects/ucap-webmessenger-app/src/app/store/account/authentication/effects.ts @@ -138,7 +138,7 @@ export class Effects { ); } }), - catchError(async error => { + catchError(error => { if (!!selfParam.autoLogin) { if (this.maxRetryCount > this.retryCount) { this.store.dispatch(logoutInitialize()); @@ -158,27 +158,28 @@ export class Effects { ); } } + this.ngZone.run(async () => { + const result = await this.dialogService.open< + AlertDialogComponent, + AlertDialogData, + AlertDialogResult + >(AlertDialogComponent, { + width: '360px', + data: { + title: this.translateService.instant( + 'accounts.errors.loginFailed' + ), + html: this.translateService.instant( + 'accounts.errors.networkFailedAndExit' + ) + } + }); - const result = await this.dialogService.open< - AlertDialogComponent, - AlertDialogData, - AlertDialogResult - >(AlertDialogComponent, { - width: '360px', - data: { - title: this.translateService.instant( - 'accounts.errors.loginFailed' - ), - html: this.translateService.instant( - 'accounts.errors.networkFailedAndExit' - ) + if (!!result) { + this.nativeService.appExit(); } }); - if (!!result) { - this.nativeService.appExit(); - } - console.log('not retry'); return of(webLoginFailure({ error })); })