diff --git a/apps/web/src/app/organizations/billing/organization-billing-history-view.component.ts b/apps/web/src/app/organizations/billing/organization-billing-history-view.component.ts index 6680b3f19a9..0c2b3f4dfda 100644 --- a/apps/web/src/app/organizations/billing/organization-billing-history-view.component.ts +++ b/apps/web/src/app/organizations/billing/organization-billing-history-view.component.ts @@ -1,22 +1,27 @@ import { Component, OnInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; -import { ApiService } from "@bitwarden/common/abstractions/api.service"; +import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction"; import { BillingHistoryResponse } from "@bitwarden/common/models/response/billingHistoryResponse"; @Component({ selector: "app-org-billing-history-view", templateUrl: "organization-billing-history-view.component.html", }) +// eslint-disable-next-line rxjs-angular/prefer-takeuntil export class OrgBillingHistoryViewComponent implements OnInit { loading = false; firstLoaded = false; billing: BillingHistoryResponse; organizationId: string; - constructor(private apiService: ApiService, private route: ActivatedRoute) {} + constructor( + private organizationApiService: OrganizationApiServiceAbstraction, + private route: ActivatedRoute + ) {} async ngOnInit() { + // eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe this.route.params.subscribe(async (params) => { this.organizationId = params.organizationId; await this.load(); @@ -29,7 +34,7 @@ export class OrgBillingHistoryViewComponent implements OnInit { return; } this.loading = true; - this.billing = await this.apiService.getOrganizationBilling(this.organizationId); + this.billing = await this.organizationApiService.getBilling(this.organizationId); this.loading = false; } } diff --git a/apps/web/src/app/organizations/reporting/reporting.component.ts b/apps/web/src/app/organizations/reporting/reporting.component.ts index 4173833b61a..fe0015499f3 100644 --- a/apps/web/src/app/organizations/reporting/reporting.component.ts +++ b/apps/web/src/app/organizations/reporting/reporting.component.ts @@ -8,6 +8,7 @@ import { Organization } from "@bitwarden/common/models/domain/organization"; selector: "app-org-reporting", templateUrl: "reporting.component.html", }) +// eslint-disable-next-line rxjs-angular/prefer-takeuntil export class ReportingComponent implements OnInit { organization: Organization; accessEvents = false; @@ -16,6 +17,7 @@ export class ReportingComponent implements OnInit { constructor(private route: ActivatedRoute, private organizationService: OrganizationService) {} ngOnInit() { + // eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe this.route.parent.params.subscribe(async (params) => { this.organization = await this.organizationService.get(params.organizationId); this.accessEvents = this.showLeftNav = this.organization.useEvents; diff --git a/apps/web/src/app/organizations/reporting/reports-home.component.ts b/apps/web/src/app/organizations/reporting/reports-home.component.ts index 36d6baa67d6..37899093646 100644 --- a/apps/web/src/app/organizations/reporting/reports-home.component.ts +++ b/apps/web/src/app/organizations/reporting/reports-home.component.ts @@ -19,8 +19,8 @@ export class ReportsHomeComponent implements OnInit, OnDestroy { constructor(private stateService: StateService, router: Router) { router.events .pipe( - takeUntil(this.destrory$), - filter((event) => event instanceof NavigationEnd) + filter((event) => event instanceof NavigationEnd), + takeUntil(this.destrory$) ) .subscribe((event) => { this.homepage = (event as NavigationEnd).urlAfterRedirects.endsWith("/reports"); diff --git a/apps/web/src/app/settings/payment-method.component.ts b/apps/web/src/app/settings/payment-method.component.ts index 7ec86b37c66..26e254036b9 100644 --- a/apps/web/src/app/settings/payment-method.component.ts +++ b/apps/web/src/app/settings/payment-method.component.ts @@ -5,6 +5,7 @@ import { ActivatedRoute, Router } from "@angular/router"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { I18nService } from "@bitwarden/common/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/abstractions/log.service"; +import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction"; import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service"; import { PaymentMethodType } from "@bitwarden/common/enums/paymentMethodType"; import { VerifyBankRequest } from "@bitwarden/common/models/request/verifyBankRequest"; @@ -17,6 +18,7 @@ import { TaxInfoComponent } from "./tax-info.component"; selector: "app-payment-method", templateUrl: "payment-method.component.html", }) +// eslint-disable-next-line rxjs-angular/prefer-takeuntil export class PaymentMethodComponent implements OnInit { @ViewChild(TaxInfoComponent) taxInfo: TaxInfoComponent; @@ -47,6 +49,7 @@ export class PaymentMethodComponent implements OnInit { constructor( protected apiService: ApiService, + protected organizationApiService: OrganizationApiServiceAbstraction, protected i18nService: I18nService, protected platformUtilsService: PlatformUtilsService, private router: Router, @@ -56,6 +59,7 @@ export class PaymentMethodComponent implements OnInit { ) {} async ngOnInit() { + // eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe this.route.params.subscribe(async (params) => { if (params.organizationId) { this.organizationId = params.organizationId; @@ -76,8 +80,8 @@ export class PaymentMethodComponent implements OnInit { this.loading = true; if (this.forOrganization) { - const billingPromise = this.apiService.getOrganizationBilling(this.organizationId); - const orgPromise = this.apiService.getOrganization(this.organizationId); + const billingPromise = this.organizationApiService.getBilling(this.organizationId); + const orgPromise = this.organizationApiService.get(this.organizationId); [this.billing, this.org] = await Promise.all([billingPromise, orgPromise]); } else { @@ -138,10 +142,7 @@ export class PaymentMethodComponent implements OnInit { const request = new VerifyBankRequest(); request.amount1 = this.verifyBankForm.value.amount1; request.amount2 = this.verifyBankForm.value.amount2; - this.verifyBankPromise = this.apiService.postOrganizationVerifyBank( - this.organizationId, - request - ); + this.verifyBankPromise = this.organizationApiService.verifyBank(this.organizationId, request); await this.verifyBankPromise; this.platformUtilsService.showToast( "success",