기능추가 ::

1. 방닫기 기능추가
2. 방나가기 시 현재 열려 있는 방 닫아주는 기능 추가.
This commit is contained in:
leejh 2019-10-24 16:53:21 +09:00
parent e7bbdeb105
commit 14ab59459f
5 changed files with 36 additions and 4 deletions

View File

@ -42,8 +42,8 @@
</button>
<mat-menu #contactMenu="matMenu">
<button mat-menu-item (click)="selectContact()">
Contact Info
<button mat-menu-item (click)="onClickContextMenu('CLOSE_ROOM')">
방닫기
</button>
</mat-menu>
</div>

View File

@ -389,4 +389,16 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewChecked {
break;
}
}
onClickContextMenu(menuType: string) {
switch (menuType) {
case 'CLOSE_ROOM':
{
this.store.dispatch(ChatStore.clearSelectedRoom());
}
break;
default:
break;
}
}
}

View File

@ -10,6 +10,10 @@ export const selectedRoom = createAction(
props<{ roomSeq: string }>()
);
export const clearSelectedRoom = createAction(
'[Messenger::Chat] clearSelectedRoom'
);
export const newEventMessage = createAction(
'[Messenger::Chat] newEventMessage',
props<{

View File

@ -5,7 +5,8 @@ import {
selectedMassDetail,
massTalkDownloadFailure,
massTalkDownload,
massTalkDownloadSuccess
massTalkDownloadSuccess,
clearSelectedRoom
} from './actions';
export const reducer = createReducer(
@ -17,6 +18,13 @@ export const reducer = createReducer(
};
}),
on(clearSelectedRoom, (state, action) => {
return {
...state,
selectedRoom: null
};
}),
on(selectedMassDetail, (state, action) => {
return {
...state,

View File

@ -181,9 +181,17 @@ export class Effects {
exit$ = createEffect(() =>
this.actions$.pipe(
ofType(exit),
exhaustMap(req => {
withLatestFrom(
this.store.pipe(
select((state: any) => state.messenger.room.roomInfo as RoomInfo)
)
),
exhaustMap(([req, roomInfo]) => {
return this.roomProtocolService.exit(req).pipe(
map((res: ExitResponse) => {
if (!!roomInfo && roomInfo.roomSeq === res.roomSeq) {
this.store.dispatch(ChatStore.clearSelectedRoom());
}
return exitSuccess({ res });
}),
catchError(error => of(exitFailure({ error })))