login refactoring
This commit is contained in:
parent
5530f769c6
commit
1cb5af9174
|
@ -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<any>,
|
||||
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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,7 +150,9 @@ export class ProtocolService {
|
|||
}
|
||||
|
||||
public disconnect(): void {
|
||||
this.messagesSubscription.unsubscribe();
|
||||
if (!!this.messagesSubscription) {
|
||||
this.messagesSubscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
public get serverMessage(): Observable<ProtocolMessage> {
|
||||
|
|
Loading…
Reference in New Issue
Block a user