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 af13181f..b5a979a2 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 @@ -146,6 +146,7 @@ export class OrganizationComponent loginInfo: LoginInfo; loginRes: LoginResponse; + loginResSubscription: Subscription; sessionVerinfo: VersionInfo2Response; environmentsInfo: EnvironmentsInfo; authInfo: AuthResponse; @@ -186,6 +187,16 @@ export class OrganizationComponent select(AppStore.MessengerSelector.QuerySelector.departmentInfoList) ); + this.loginResSubscription = this.store + .pipe( + take(1), + select(AppStore.AccountSelector.AuthenticationSelector.loginRes), + tap(loginRes => { + this.loginRes = loginRes; + }) + ) + .subscribe(); + this.myDepartmentUserInfoListSubscription = this.store .pipe( select( @@ -230,6 +241,14 @@ export class OrganizationComponent this.selectedDepartmentUserInfoList = list; } + if (!!this.loginRes) { + this.selectedDepartmentName = { + name: this.loginRes.userInfo.deptName, + nameEn: this.loginRes.userInfo.deptNameEn, + nameCn: this.loginRes.userInfo.deptNameCn + }; + } + if (!!this.vsDeptUser) { this.vsDeptUser.scrollToIndex(0, true, 0, 0); } @@ -252,6 +271,9 @@ export class OrganizationComponent } ngOnDestroy(): void { + if (!!this.loginResSubscription) { + this.loginResSubscription.unsubscribe(); + } if (!!this.myDepartmentUserInfoListSubscription) { this.myDepartmentUserInfoListSubscription.unsubscribe(); }