팝업 닫는 로직 통합에 의한 불필요 소스 제거.

This commit is contained in:
leejinho 2020-02-04 13:37:56 +09:00
parent ad78e23303
commit b58e52325d
5 changed files with 5 additions and 59 deletions

View File

@ -15,9 +15,6 @@ import { FileDownloadItem } from '@ucap-webmessenger/api';
import { CommonApiService } from '@ucap-webmessenger/api-common'; import { CommonApiService } from '@ucap-webmessenger/api-common';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { FileProtocolService } from '@ucap-webmessenger/protocol-file'; 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 { export interface FileViewerDialogData {
fileInfo: FileEventJson; fileInfo: FileEventJson;
@ -35,8 +32,6 @@ export interface FileViewerDialogResult {}
styleUrls: ['./file-viewer.dialog.component.scss'] styleUrls: ['./file-viewer.dialog.component.scss']
}) })
export class FileViewerDialogComponent implements OnInit, OnDestroy { export class FileViewerDialogComponent implements OnInit, OnDestroy {
loginResSubscription: Subscription;
fileInfo: FileEventJson; fileInfo: FileEventJson;
downloadUrl: string; downloadUrl: string;
userSeq: number; userSeq: number;
@ -56,7 +51,6 @@ export class FileViewerDialogComponent implements OnInit, OnDestroy {
private snackBarService: SnackBarService, private snackBarService: SnackBarService,
private commonApiService: CommonApiService, private commonApiService: CommonApiService,
private fileProtocolService: FileProtocolService, private fileProtocolService: FileProtocolService,
private store: Store<any>,
private logger: NGXLogger private logger: NGXLogger
) { ) {
this.fileInfo = data.fileInfo; this.fileInfo = data.fileInfo;
@ -76,24 +70,9 @@ 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 { onDownload(fileDownloadItem: FileDownloadItem): void {
this.commonApiService this.commonApiService

View File

@ -174,10 +174,6 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
.pipe( .pipe(
select(AppStore.AccountSelector.AuthenticationSelector.loginRes), select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
tap(loginRes => { tap(loginRes => {
if (!loginRes) {
this.onClickCancel();
}
this.loginRes = loginRes; this.loginRes = loginRes;
}) })
) )

View File

@ -1,10 +1,6 @@
import { Component, OnInit, Inject, OnDestroy } from '@angular/core'; import { Component, OnInit, Inject, OnDestroy } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { NoticeList } from '@ucap-webmessenger/api-message'; 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 { export interface NoticeDetailDialogData {
notice: NoticeList; notice: NoticeList;
@ -18,35 +14,17 @@ export interface NoticeDetailDialogResult {}
styleUrls: ['./notice-detail.dialog.component.scss'] styleUrls: ['./notice-detail.dialog.component.scss']
}) })
export class NoticeDetailDialogComponent implements OnInit, OnDestroy { export class NoticeDetailDialogComponent implements OnInit, OnDestroy {
loginResSubscription: Subscription;
constructor( constructor(
public dialogRef: MatDialogRef< public dialogRef: MatDialogRef<
NoticeDetailDialogData, NoticeDetailDialogData,
NoticeDetailDialogResult 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 { ngOnDestroy(): void {}
if (!!this.loginResSubscription) {
this.loginResSubscription.unsubscribe();
}
}
onClickConfirm(): void { onClickConfirm(): void {
this.dialogRef.close(); this.dialogRef.close();

View File

@ -119,10 +119,6 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
.pipe( .pipe(
select(AppStore.AccountSelector.AuthenticationSelector.loginRes), select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
tap(loginRes => { tap(loginRes => {
if (!loginRes) {
this.onClose();
}
this.loginRes = loginRes; this.loginRes = loginRes;
if (!!loginRes && loginRes.userSeq === this.data.userInfo.seq) { if (!!loginRes && loginRes.userSeq === this.data.userInfo.seq) {
this.isMe = true; this.isMe = true;

View File

@ -86,9 +86,6 @@ export class IntegratedSearchDialogComponent implements OnInit, OnDestroy {
.pipe( .pipe(
select(AppStore.AccountSelector.AuthenticationSelector.loginRes), select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
tap(loginRes => { tap(loginRes => {
if (!loginRes) {
this.onCancel();
}
this.loginRes = loginRes; this.loginRes = loginRes;
}) })
) )