bugfix ::

logout 시 에러.
팝업 오픈시에 로그아웃되면 팝업이 남아있는 문제.
This commit is contained in:
leejinho 2020-02-04 11:29:55 +09:00
parent f98acedbb2
commit e38a22d998
7 changed files with 90 additions and 27 deletions

View File

@ -15,6 +15,9 @@ import { FileDownloadItem } from '@ucap-webmessenger/api';
import { CommonApiService } from '@ucap-webmessenger/api-common';
import { TranslateService } from '@ngx-translate/core';
import { FileProtocolService } from '@ucap-webmessenger/protocol-file';
import { select, Store } from '@ngrx/store';
import { Subscription } from 'rxjs';
import * as AppStore from '@app/store';
export interface FileViewerDialogData {
fileInfo: FileEventJson;
@ -32,6 +35,8 @@ export interface FileViewerDialogResult {}
styleUrls: ['./file-viewer.dialog.component.scss']
})
export class FileViewerDialogComponent implements OnInit, OnDestroy {
loginResSubscription: Subscription;
fileInfo: FileEventJson;
downloadUrl: string;
userSeq: number;
@ -51,6 +56,7 @@ export class FileViewerDialogComponent implements OnInit, OnDestroy {
private snackBarService: SnackBarService,
private commonApiService: CommonApiService,
private fileProtocolService: FileProtocolService,
private store: Store<any>,
private logger: NGXLogger
) {
this.fileInfo = data.fileInfo;
@ -70,9 +76,24 @@ export class FileViewerDialogComponent implements OnInit, OnDestroy {
);
}
ngOnInit() {}
ngOnInit() {
this.loginResSubscription = this.store
.pipe(
select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
tap(loginRes => {
if (!loginRes) {
this.onClosedViewer();
}
})
)
.subscribe();
}
ngOnDestroy(): void {}
ngOnDestroy(): void {
if (!!this.loginResSubscription) {
this.loginResSubscription.unsubscribe();
}
}
onDownload(fileDownloadItem: FileDownloadItem): void {
this.commonApiService

View File

@ -174,6 +174,10 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
.pipe(
select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
tap(loginRes => {
if (!loginRes) {
this.onClickCancel();
}
this.loginRes = loginRes;
})
)
@ -197,10 +201,9 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
groupList.forEach(group => {
if (
!!environment.productConfig.CommonSetting
.useMyDeptGroup &&
environment.productConfig.CommonSetting
.myDeptGroupSeq === group.seq
!!environment.productConfig.CommonSetting.useMyDeptGroup &&
environment.productConfig.CommonSetting.myDeptGroupSeq ===
group.seq
) {
myDeptGroup = group;
} else if (0 === group.seq) {

View File

@ -1,6 +1,10 @@
import { Component, OnInit, Inject, ViewChild, OnDestroy } from '@angular/core';
import { Component, OnInit, Inject, OnDestroy } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { NoticeList } from '@ucap-webmessenger/api-message';
import { Subscription } from 'rxjs';
import { select, Store } from '@ngrx/store';
import { tap } from 'rxjs/operators';
import * as AppStore from '@app/store';
export interface NoticeDetailDialogData {
notice: NoticeList;
@ -13,16 +17,36 @@ export interface NoticeDetailDialogResult {}
templateUrl: './notice-detail.dialog.component.html',
styleUrls: ['./notice-detail.dialog.component.scss']
})
export class NoticeDetailDialogComponent implements OnInit {
export class NoticeDetailDialogComponent implements OnInit, OnDestroy {
loginResSubscription: Subscription;
constructor(
public dialogRef: MatDialogRef<
NoticeDetailDialogData,
NoticeDetailDialogResult
>,
@Inject(MAT_DIALOG_DATA) public data: NoticeDetailDialogData
@Inject(MAT_DIALOG_DATA) public data: NoticeDetailDialogData,
private store: Store<any>
) {}
ngOnInit() {}
ngOnInit() {
this.loginResSubscription = this.store
.pipe(
select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
tap(loginRes => {
if (!loginRes) {
this.onClickConfirm();
}
})
)
.subscribe();
}
ngOnDestroy(): void {
if (!!this.loginResSubscription) {
this.loginResSubscription.unsubscribe();
}
}
onClickConfirm(): void {
this.dialogRef.close();

View File

@ -3,7 +3,7 @@
[profileImageRoot]="sessionVerinfo.profileRoot"
[editableProfileImage]="editableProfileImage"
[isMe]="isMe"
[myMadn]="loginRes.madn"
[myMadn]="loginRes?.madn"
[isBuddy]="isBuddy"
[isFavorit]="isFavorit"
[openProfileOptions]="data.openProfileOptions"

View File

@ -119,8 +119,12 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
.pipe(
select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
tap(loginRes => {
if (!loginRes) {
this.onClose();
}
this.loginRes = loginRes;
if (loginRes.userSeq === this.data.userInfo.seq) {
if (!!loginRes && loginRes.userSeq === this.data.userInfo.seq) {
this.isMe = true;
this.userInfo = {
...this.userInfo,
@ -129,7 +133,6 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
} else {
this.isMe = false;
}
1;
})
)
.subscribe();

View File

@ -1,6 +1,6 @@
import { Component, OnInit, Inject, OnDestroy } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA, PageEvent } from '@angular/material';
import { KEY_LOGIN_RES_INFO, KEY_VER_INFO } from '@app/types';
import { KEY_VER_INFO } from '@app/types';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { Store, select } from '@ngrx/store';
@ -16,13 +16,12 @@ import {
DeptUserResponse
} from '@ucap-webmessenger/protocol-query';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { map, catchError, take } from 'rxjs/operators';
import { map, catchError, take, tap } from 'rxjs/operators';
import { Subscription, of, Observable } from 'rxjs';
import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types';
import { NGXLogger } from 'ngx-logger';
import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
import { environment } from '../../../../../environments/environment';
import { TranslateService } from '@ngx-translate/core';
import { StatusBulkInfo } from '@ucap-webmessenger/protocol-status';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { DaesangProtocolService } from '@ucap-webmessenger/daesang';
@ -46,6 +45,7 @@ export interface IntegratedSearchDialogResult {}
})
export class IntegratedSearchDialogComponent implements OnInit, OnDestroy {
loginRes: LoginResponse;
loginResSubscription: Subscription;
sessionVerinfo: VersionInfo2Response;
environmentsInfo: EnvironmentsInfo;
@ -73,9 +73,6 @@ export class IntegratedSearchDialogComponent implements OnInit, OnDestroy {
private store: Store<any>,
private logger: NGXLogger
) {
this.loginRes = this.sessionStorageService.get<LoginResponse>(
KEY_LOGIN_RES_INFO
);
this.environmentsInfo = this.sessionStorageService.get<EnvironmentsInfo>(
KEY_ENVIRONMENTS_INFO
);
@ -85,6 +82,18 @@ export class IntegratedSearchDialogComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.loginResSubscription = this.store
.pipe(
select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
tap(loginRes => {
if (!loginRes) {
this.onCancel();
}
this.loginRes = loginRes;
})
)
.subscribe();
this.onSearch(this.data.keyword);
this.presence$ = this.store.pipe(
@ -92,6 +101,15 @@ export class IntegratedSearchDialogComponent implements OnInit, OnDestroy {
);
}
ngOnDestroy(): void {
if (!!this.searchSubscription) {
this.searchSubscription.unsubscribe();
}
if (!!this.loginResSubscription) {
this.loginResSubscription.unsubscribe();
}
}
onReSearch(searchWord: string) {
this.pageCurrent = 1;
@ -163,12 +181,6 @@ export class IntegratedSearchDialogComponent implements OnInit, OnDestroy {
}
}
ngOnDestroy(): void {
if (!!this.searchSubscription) {
this.searchSubscription.unsubscribe();
}
}
onCancel(): void {
this.dialogRef.close({});
}
@ -208,7 +220,7 @@ export class IntegratedSearchDialogComponent implements OnInit, OnDestroy {
if (!!result) {
if (!!result.closeEvent && result.closeEvent === 'CHAT') {
this.dialogRef.close({});
this.onCancel();
}
}
}

View File

@ -57,7 +57,7 @@
*ngFor="let message of scroll.viewPortItems; trackBy: trackByEvent"
[id]="message.seq"
[message]="message"
[mine]="message.senderSeq === loginRes.userSeq"
[mine]="message.senderSeq === loginRes?.userSeq"
[highlight]="isHighlightedEvent(message.seq)"
[existReadToHere]="
!!readToHereEvent && readToHereEvent.seq === message.seq