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 681f25b0..47b49307 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 @@ -3,7 +3,7 @@ import { Component, OnInit, OnDestroy } from '@angular/core'; import { Store, select } from '@ngrx/store'; import { Company } from '@ucap-webmessenger/api-external'; -import { ServerErrorCode } from '@ucap-webmessenger/protocol'; +import { ServerErrorCode, ProtocolService } from '@ucap-webmessenger/protocol'; import * as AppStore from '@app/store'; import * as AuthenticationStore from '@app/store/account/authentication'; @@ -31,6 +31,8 @@ import { } from '@ucap-webmessenger/web-storage'; import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type'; import { LogoutInfo, KEY_LOGOUT_INFO } from '@app/types'; +import { AppAuthenticationService } from '@app/services/authentication.service'; +import { logoutInitialize } from '@app/store/account/authentication'; @Component({ selector: 'app-page-account-login', @@ -84,8 +86,10 @@ export class LoginPageComponent implements OnInit, OnDestroy { private store: Store, private router: Router, private dialogService: DialogService, + private protocolService: ProtocolService, private localStorageService: LocalStorageService, - private sessionStorageService: SessionStorageService + private sessionStorageService: SessionStorageService, + private appAuthenticationService: AppAuthenticationService ) { this.useRememberMe = environment.productConfig.authentication.rememberMe.use; @@ -101,6 +105,10 @@ export class LoginPageComponent implements OnInit, OnDestroy { } ngOnInit(): void { + // this.appAuthenticationService.logout(); + this.protocolService.disconnect(); + this.store.dispatch(logoutInitialize()); + this.rotateInfomationIntervalObject = setInterval(() => { this.rotateInfomationIndex = (this.rotateInfomationIndex + 1) % this.rotateInfomation.length; @@ -179,7 +187,7 @@ export class LoginPageComponent implements OnInit, OnDestroy { !!personLogout.reasonCode && personLogout.reasonCode === ServerErrorCode.ERRCD_DUPLICATE ) { - const result = await this.dialogService.open< + const result = this.dialogService.open< AlertDialogComponent, AlertDialogData, AlertDialogResult diff --git a/projects/ucap-webmessenger-app/src/app/services/authentication.service.ts b/projects/ucap-webmessenger-app/src/app/services/authentication.service.ts index ebd1d012..bbcc2aa8 100644 --- a/projects/ucap-webmessenger-app/src/app/services/authentication.service.ts +++ b/projects/ucap-webmessenger-app/src/app/services/authentication.service.ts @@ -12,7 +12,8 @@ import { KEY_VER_INFO, KEY_URL_INFO, KEY_LOGOUT_INFO, - LogoutInfo + LogoutInfo, + KEY_AUTH_INFO } from '../types'; import { PasswordUtil } from '@ucap-webmessenger/pi'; @@ -106,5 +107,6 @@ export class AppAuthenticationService { this.sessionStorageService.remove(KEY_VER_INFO); this.sessionStorageService.remove(KEY_LOGIN_INFO); this.sessionStorageService.remove(KEY_URL_INFO); + this.sessionStorageService.remove(KEY_AUTH_INFO); } } diff --git a/projects/ucap-webmessenger-protocol/src/lib/services/protocol.service.ts b/projects/ucap-webmessenger-protocol/src/lib/services/protocol.service.ts index f1abf007..4cdad47b 100644 --- a/projects/ucap-webmessenger-protocol/src/lib/services/protocol.service.ts +++ b/projects/ucap-webmessenger-protocol/src/lib/services/protocol.service.ts @@ -150,7 +150,9 @@ export class ProtocolService { } public disconnect(): void { - this.messagesSubscription.unsubscribe(); + if (!!this.messagesSubscription) { + this.messagesSubscription.unsubscribe(); + } } public get serverMessage(): Observable {