diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/status/effects.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/status/effects.ts index 928604e7..bb2ee150 100644 --- a/projects/ucap-webmessenger-app/src/app/store/messenger/status/effects.ts +++ b/projects/ucap-webmessenger-app/src/app/store/messenger/status/effects.ts @@ -36,6 +36,9 @@ import { MessageUpdateResponse } from '@ucap-webmessenger/protocol-status'; import { of } from 'rxjs'; +import { SessionStorageService } from '@ucap-webmessenger/web-storage'; +import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; +import { KEY_LOGIN_RES_INFO } from '@app/types'; @Injectable() export class Effects { @@ -48,6 +51,14 @@ export class Effects { userSeqList.push(buddy.seq); } + const loginResInfo: LoginResponse = this.sessionStorageService.get< + LoginResponse + >(KEY_LOGIN_RES_INFO); + if (!!loginResInfo) { + // import my status. + userSeqList.push(loginResInfo.userSeq); + } + return bulkInfo({ divCd: 'bulk', userSeqs: userSeqList }); }) ) @@ -128,23 +139,23 @@ export class Effects { ) ); - myStatusCheck$ = createEffect( - () => - this.actions$.pipe( - ofType(AuthStore.loginSuccess), - map(action => action.loginRes), - delay(5000), - tap(loginRes => { - this.store.dispatch( - bulkInfo({ divCd: 'mybulk', userSeqs: [loginRes.userSeq] }) - ); - // return bulkInfo({ divCd: 'bulk', userSeqs: [loginRes.userSeq] }); - }) - ), - { dispatch: false } - ); + // myStatusCheck$ = createEffect( + // () => + // this.actions$.pipe( + // ofType(AuthStore.loginSuccess), + // map(action => action.loginRes), + // delay(5000), + // tap(loginRes => { + // this.store.dispatch( + // bulkInfo({ divCd: 'mybulk', userSeqs: [loginRes.userSeq] }) + // ); + // // return bulkInfo({ divCd: 'bulk', userSeqs: [loginRes.userSeq] }); + // }) + // ), + // { dispatch: false } + // ); - mroomUserStatusCheck$ = createEffect( + roomUserStatusCheck$ = createEffect( () => this.actions$.pipe( ofType(RoomStore.infoSuccess), @@ -167,6 +178,7 @@ export class Effects { private actions$: Actions, private store: Store, private statusProtocolService: StatusProtocolService, + private sessionStorageService: SessionStorageService, private logger: NGXLogger ) {} } diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/status/reducers.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/status/reducers.ts index 58b82aef..79ff836d 100644 --- a/projects/ucap-webmessenger-app/src/app/store/messenger/status/reducers.ts +++ b/projects/ucap-webmessenger-app/src/app/store/messenger/status/reducers.ts @@ -35,22 +35,24 @@ export const reducer = createReducer( const noti = action.noti; const statusBulkInfoState: StatusBulkInfo = { - ...state.statusBulkInfo.entities[noti.userSeq], + userSeq: noti.userSeq, conferenceStatus: noti.conferenceStatus, imessengerStatus: noti.imessengerStatus, mobileConferenceStatus: noti.mobileConferenceStatus, mobileStatus: noti.mobileStatus, pcStatus: noti.pcStatus, phoneStatus: noti.phoneStatus, - statusMessage: noti.statusMessage + statusMessage: noti.statusMessage, + terminalStatus: TerminalStatusInfo.Unknown, + terminalStatusNumber: TerminalStatusNumber.Unknown, + workstatus: noti.workstatus }; return { ...state, - statusBulkInfo: adapterStatusBulkInfo.updateOne( - { id: noti.userSeq, changes: statusBulkInfoState }, - { ...state.statusBulkInfo } - ) + statusBulkInfo: adapterStatusBulkInfo.upsertOne(statusBulkInfoState, { + ...state.statusBulkInfo + }) }; }),