diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts index 1d6376b5..7df6d991 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit, ViewChild } from '@angular/core'; -import { Observable, combineLatest } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { Observable, combineLatest, Subscription } from 'rxjs'; +import { map, tap } from 'rxjs/operators'; import { Store, select } from '@ngrx/store'; @@ -10,6 +10,7 @@ import { UserInfo, GroupDetailData } from '@ucap-webmessenger/protocol-sync'; import * as AppStore from '@app/store'; import * as ChatStore from '@app/store/messenger/chat'; +import * as QueryStore from '@app/store/messenger/query'; import { NGXLogger } from 'ngx-logger'; import { Company } from '@ucap-webmessenger/api-external'; import { SessionStorageService } from '@ucap-webmessenger/web-storage'; @@ -20,6 +21,8 @@ import { CreateGroupDialogData, CreateGroupDialogResult } from '@app/layouts/messenger/dialogs/create-group.dialog.component'; +import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; +import { DeptSearchType } from '@ucap-webmessenger/protocol-query'; @Component({ selector: 'app-layout-chat-left-sidenav-group', @@ -37,6 +40,9 @@ export class GroupComponent implements OnInit { companyList$: Observable; companyCode: string; + loginRes: LoginResponse; + loginResSubscription: Subscription; + constructor( private store: Store, private sessionStorageService: SessionStorageService, @@ -48,6 +54,15 @@ export class GroupComponent implements OnInit { const loginInfo = this.sessionStorageService.get(KEY_LOGIN_INFO); this.companyCode = loginInfo.companyCode; + this.loginResSubscription = this.store + .pipe( + select(AppStore.AccountSelector.AuthenticationSelector.loginRes), + tap(loginRes => { + this.loginRes = loginRes; + }) + ) + .subscribe(); + this.companyList$ = this.store.pipe( select(AppStore.SettingSelector.CompanySelector.companyList) ); @@ -143,6 +158,15 @@ export class GroupComponent implements OnInit { companyCode: string; searchWord: string; }) { - this.logger.debug('params', params); + this.store.dispatch( + QueryStore.deptUser({ + divCd: 'GRP', + companyCode: params.companyCode, + searchRange: DeptSearchType.All, + search: params.searchWord, + senderCompanyCode: params.companyCode, + senderEmployeeType: this.loginRes.userInfo.employeeType + }) + ); } } diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts index d67cbd5a..93170636 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit, OnDestroy } from '@angular/core'; import { ucapAnimations } from '@ucap-webmessenger/ui'; import { Store, select } from '@ngrx/store'; import { NGXLogger } from 'ngx-logger'; -import { Observable, Subscriber, Subscription } from 'rxjs'; +import { Observable, Subscription } from 'rxjs'; import { Info, EventType } from '@ucap-webmessenger/protocol-event'; import * as AppStore from '@app/store'; @@ -11,7 +11,7 @@ import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { LoginInfo, KEY_LOGIN_INFO } from '@app/types'; import { RoomInfo } from '@ucap-webmessenger/protocol-room'; -import { map, tap } from 'rxjs/operators'; +import { tap } from 'rxjs/operators'; @Component({ selector: 'app-layout-messenger-messages',