이미 열린 방에 대해서 다시 열고자 할때 갱신하지 않도록 수정. ChatStore.selectedRoom effect 수정.
This commit is contained in:
parent
97befdc860
commit
81866a23fb
|
@ -21,6 +21,8 @@ export const clearSelectedRoom = createAction(
|
|||
'[Messenger::Chat] clearSelectedRoom'
|
||||
);
|
||||
|
||||
export const clearEvent = createAction('[Messenger::Room] Clear Event');
|
||||
|
||||
export const newEventMessage = createAction(
|
||||
'[Messenger::Chat] newEventMessage',
|
||||
props<{
|
||||
|
|
|
@ -144,7 +144,7 @@ export const reducer = createReducer(
|
|||
};
|
||||
}),
|
||||
|
||||
on(ChatStore.selectedRoom, (state, action) => {
|
||||
on(ChatStore.clearEvent, (state, action) => {
|
||||
return {
|
||||
...initialState
|
||||
};
|
||||
|
|
|
@ -76,20 +76,35 @@ import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
|
|||
|
||||
@Injectable()
|
||||
export class Effects {
|
||||
selectedRoomForInfo$ = createEffect(() =>
|
||||
this.actions$.pipe(
|
||||
ofType(ChatStore.selectedRoom),
|
||||
map(action => {
|
||||
const loginInfo = this.sessionStorageService.get<LoginInfo>(
|
||||
KEY_LOGIN_INFO
|
||||
);
|
||||
return info({
|
||||
roomSeq: action.roomSeq,
|
||||
isDetail: true,
|
||||
localeCode: loginInfo.localeCode
|
||||
});
|
||||
})
|
||||
)
|
||||
selectedRoomForInfo$ = createEffect(
|
||||
() => {
|
||||
return this.actions$.pipe(
|
||||
ofType(ChatStore.selectedRoom),
|
||||
withLatestFrom(
|
||||
this.store.pipe(
|
||||
select((state: any) => state.messenger.room.roomInfo as RoomInfo)
|
||||
)
|
||||
),
|
||||
map(([action, roomInfo]) => {
|
||||
if (!!roomInfo && roomInfo.roomSeq === action.roomSeq) {
|
||||
} else {
|
||||
this.store.dispatch(ChatStore.clearEvent());
|
||||
|
||||
const loginInfo = this.sessionStorageService.get<LoginInfo>(
|
||||
KEY_LOGIN_INFO
|
||||
);
|
||||
this.store.dispatch(
|
||||
info({
|
||||
roomSeq: action.roomSeq,
|
||||
isDetail: true,
|
||||
localeCode: loginInfo.localeCode
|
||||
})
|
||||
);
|
||||
}
|
||||
})
|
||||
);
|
||||
},
|
||||
{ dispatch: false }
|
||||
);
|
||||
|
||||
info$ = createEffect(
|
||||
|
|
Loading…
Reference in New Issue
Block a user