mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
Migrate OrganizationService to StateProvider (#7895)
This commit is contained in:
@@ -10,6 +10,8 @@ import {
|
||||
Subject,
|
||||
switchMap,
|
||||
takeUntil,
|
||||
map,
|
||||
concatMap,
|
||||
} from "rxjs";
|
||||
|
||||
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
|
||||
@@ -70,11 +72,18 @@ export class ProjectComponent implements OnInit, OnDestroy {
|
||||
}),
|
||||
);
|
||||
|
||||
this.route.params.pipe(takeUntil(this.destroy$)).subscribe((params) => {
|
||||
this.organizationId = params.organizationId;
|
||||
this.projectId = params.projectId;
|
||||
this.organizationEnabled = this.organizationService.get(params.organizationId)?.enabled;
|
||||
});
|
||||
const projectId$ = this.route.params.pipe(map((p) => p.projectId));
|
||||
const organization$ = this.route.params.pipe(
|
||||
concatMap((params) => this.organizationService.get$(params.organizationId)),
|
||||
);
|
||||
|
||||
combineLatest([projectId$, organization$])
|
||||
.pipe(takeUntil(this.destroy$))
|
||||
.subscribe(([projectId, organization]) => {
|
||||
this.organizationId = organization.id;
|
||||
this.projectId = projectId;
|
||||
this.organizationEnabled = organization.enabled;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
|
||||
Reference in New Issue
Block a user