35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import { Component, OnDestroy, OnInit } from "@angular/core";
|
|
import { ActivatedRoute } from "@angular/router";
|
|
import { Subject, switchMap, takeUntil } from "rxjs";
|
|
|
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization/organization.service.abstraction";
|
|
import { Organization } from "@bitwarden/common/models/domain/organization";
|
|
|
|
@Component({
|
|
selector: "app-org-settings",
|
|
templateUrl: "settings.component.html",
|
|
})
|
|
export class SettingsComponent implements OnInit, OnDestroy {
|
|
organization: Organization;
|
|
|
|
private destroy$ = new Subject<void>();
|
|
|
|
constructor(private route: ActivatedRoute, private organizationService: OrganizationService) {}
|
|
|
|
ngOnInit() {
|
|
this.route.params
|
|
.pipe(
|
|
switchMap(async (params) => await this.organizationService.get(params.organizationId)),
|
|
takeUntil(this.destroy$)
|
|
)
|
|
.subscribe((organization) => {
|
|
this.organization = organization;
|
|
});
|
|
}
|
|
|
|
ngOnDestroy(): void {
|
|
this.destroy$.next();
|
|
this.destroy$.complete();
|
|
}
|
|
}
|