From 0766bb6134ca37842be345c2b034712867504b19 Mon Sep 17 00:00:00 2001 From: richard-loafle <44828666+richard-loafle@users.noreply.github.com> Date: Wed, 5 Feb 2020 11:07:43 +0900 Subject: [PATCH] bug fixed --- .../left-sidenav/organization.component.ts | 61 ++++++++++--------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts index 2442c79a..af13181f 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts @@ -193,6 +193,38 @@ export class OrganizationComponent ) ) .subscribe(list => { + if (!list) { + this.store + .pipe( + take(1), + select(AppStore.AccountSelector.AuthenticationSelector.loginRes), + map(loginRes => { + this.store.dispatch( + QueryStore.myDeptUser({ + divCd: 'ORG', + companyCode: this.loginInfo.companyCode, + seq: loginRes.departmentCode, + search: '', + searchRange: DeptSearchType.All, + senderCompanyCode: this.loginInfo.companyCode, + senderEmployeeType: loginRes.userInfo.employeeType + }) + ); + return loginRes; + }), + map(loginRes => { + this.loginRes = loginRes; + this.selectedDepartmentName = { + name: loginRes.userInfo.deptName, + nameEn: loginRes.userInfo.deptNameEn, + nameCn: loginRes.userInfo.deptNameCn + }; + }) + ) + .subscribe(); + return; + } + this.myDepartmentUserInfoList = list; if (!this.selectedDepartmentUserInfoList) { this.selectedDepartmentUserInfoList = list; @@ -205,35 +237,6 @@ export class OrganizationComponent this.psDirectiveRef.update(); } }); - - this.store - .pipe( - take(1), - select(AppStore.AccountSelector.AuthenticationSelector.loginRes), - map(loginRes => { - this.store.dispatch( - QueryStore.myDeptUser({ - divCd: 'ORG', - companyCode: this.loginInfo.companyCode, - seq: loginRes.departmentCode, - search: '', - searchRange: DeptSearchType.All, - senderCompanyCode: this.loginInfo.companyCode, - senderEmployeeType: loginRes.userInfo.employeeType - }) - ); - return loginRes; - }), - map(loginRes => { - this.loginRes = loginRes; - this.selectedDepartmentName = { - name: loginRes.userInfo.deptName, - nameEn: loginRes.userInfo.deptNameEn, - nameCn: loginRes.userInfo.deptNameCn - }; - }) - ) - .subscribe(); } ngAfterViewChecked(): void {