delete of message is added
This commit is contained in:
parent
6f9702f3db
commit
daa4bc2ba9
|
@ -24,7 +24,7 @@ import {
|
|||
QueryProtocolService
|
||||
} from '@ucap-webmessenger/protocol-query';
|
||||
import { StatusProtocolService } from '@ucap-webmessenger/protocol-status';
|
||||
import { StatusType, StatusCode } from '@ucap-webmessenger/core';
|
||||
import { StatusType, StatusCode, DeviceType } from '@ucap-webmessenger/core';
|
||||
import {
|
||||
DialogService,
|
||||
ConfirmDialogComponent,
|
||||
|
@ -53,7 +53,9 @@ import { SessionStorageService } from '@ucap-webmessenger/web-storage';
|
|||
import {
|
||||
MessageApiService,
|
||||
MessageType,
|
||||
DetailRequest
|
||||
DetailRequest,
|
||||
MessageDetailInfo,
|
||||
DelRequest
|
||||
} from '@ucap-webmessenger/api-message';
|
||||
import { MessageStatusCode } from '@ucap-webmessenger/api';
|
||||
import {
|
||||
|
@ -166,10 +168,10 @@ export class MainPageComponent implements OnInit, OnDestroy {
|
|||
} as DetailRequest)
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => {
|
||||
map(async res => {
|
||||
if (res.responseCode === MessageStatusCode.Success) {
|
||||
// detail view..
|
||||
this.dialogService.open<
|
||||
const result = await this.dialogService.open<
|
||||
MessageDetailDialogComponent,
|
||||
MessageDetailDialogData,
|
||||
MessageDetailDialogResult
|
||||
|
@ -182,7 +184,14 @@ export class MainPageComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
});
|
||||
|
||||
// this.changeDetectorRef.detectChanges();
|
||||
if (!!result) {
|
||||
switch (result.returnType) {
|
||||
case 'DEL':
|
||||
// 단건 삭제.
|
||||
this.doMessageDelete([result.messageInfo]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}),
|
||||
|
@ -377,4 +386,29 @@ export class MainPageComponent implements OnInit, OnDestroy {
|
|||
onCloseRightDrawer() {
|
||||
this.rightDrawer.close();
|
||||
}
|
||||
|
||||
/** 쪽지(수신,발신) 삭제 */
|
||||
doMessageDelete(messageInfo: MessageDetailInfo[]): void {
|
||||
const msgList: { msgId: number }[] = [];
|
||||
messageInfo.forEach(info => msgList.push({ msgId: info.msgId }));
|
||||
this.messageApiService
|
||||
.deleteMessage({
|
||||
userSeq: this.loginRes.userSeq,
|
||||
deviceType: DeviceType.PC,
|
||||
tokenKey: this.loginRes.tokenString,
|
||||
type: messageInfo[0].type,
|
||||
msgList
|
||||
} as DelRequest)
|
||||
.pipe(
|
||||
take(1),
|
||||
map(async res => {
|
||||
if (res.responseCode === MessageStatusCode.Success) {
|
||||
} else {
|
||||
this.logger.error('message delete Error!');
|
||||
}
|
||||
}),
|
||||
catchError(error => of(this.logger.error(error)))
|
||||
)
|
||||
.subscribe();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user