mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[PM 21106]Remove button not responsive for admin Console Remove Sponorship (#14743)
* Resolve the remove button inactive * Resolve the lint error
This commit is contained in:
@@ -179,7 +179,7 @@ export class FreeBitwardenFamiliesComponent implements OnInit {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.apiService.deleteRevokeSponsorship(this.organizationId);
|
||||
await this.organizationSponsorshipApiService.deleteRevokeSponsorship(this.organizationId, true);
|
||||
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
|
||||
@@ -109,7 +109,7 @@ export class SponsoringOrgRowComponent implements OnInit {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.apiService.deleteRevokeSponsorship(this.sponsoringOrg.id);
|
||||
await this.organizationSponsorshipApiService.deleteRevokeSponsorship(this.sponsoringOrg.id);
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
|
||||
@@ -1079,7 +1079,7 @@ const safeProviders: SafeProvider[] = [
|
||||
safeProvider({
|
||||
provide: OrganizationSponsorshipApiServiceAbstraction,
|
||||
useClass: OrganizationSponsorshipApiService,
|
||||
deps: [ApiServiceAbstraction],
|
||||
deps: [ApiServiceAbstraction, PlatformUtilsServiceAbstraction],
|
||||
}),
|
||||
safeProvider({
|
||||
provide: OrganizationBillingApiServiceAbstraction,
|
||||
|
||||
@@ -475,7 +475,6 @@ export abstract class ApiService {
|
||||
getSponsorshipSyncStatus: (
|
||||
sponsoredOrgId: string,
|
||||
) => Promise<OrganizationSponsorshipSyncStatusResponse>;
|
||||
deleteRevokeSponsorship: (sponsoringOrganizationId: string) => Promise<void>;
|
||||
deleteRemoveSponsorship: (sponsoringOrgId: string) => Promise<void>;
|
||||
postPreValidateSponsorshipToken: (
|
||||
sponsorshipToken: string,
|
||||
|
||||
@@ -10,4 +10,9 @@ export abstract class OrganizationSponsorshipApiServiceAbstraction {
|
||||
sponsoringOrgId: string,
|
||||
friendlyName?: string,
|
||||
): Promise<void>;
|
||||
|
||||
abstract deleteRevokeSponsorship: (
|
||||
sponsoringOrganizationId: string,
|
||||
isAdminInitiated?: boolean,
|
||||
) => Promise<void>;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
import { ApiService } from "../../../abstractions/api.service";
|
||||
import { ListResponse } from "../../../models/response/list.response";
|
||||
import { PlatformUtilsService } from "../../../platform/abstractions/platform-utils.service";
|
||||
import { OrganizationSponsorshipApiServiceAbstraction } from "../../abstractions/organizations/organization-sponsorship-api.service.abstraction";
|
||||
import { OrganizationSponsorshipInvitesResponse } from "../../models/response/organization-sponsorship-invites.response";
|
||||
|
||||
export class OrganizationSponsorshipApiService
|
||||
implements OrganizationSponsorshipApiServiceAbstraction
|
||||
{
|
||||
constructor(private apiService: ApiService) {}
|
||||
constructor(
|
||||
private apiService: ApiService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
) {}
|
||||
async getOrganizationSponsorship(
|
||||
sponsoredOrgId: string,
|
||||
): Promise<ListResponse<OrganizationSponsorshipInvitesResponse>> {
|
||||
@@ -33,4 +37,21 @@ export class OrganizationSponsorshipApiService
|
||||
|
||||
return await this.apiService.send("POST", url, null, true, false);
|
||||
}
|
||||
|
||||
async deleteRevokeSponsorship(
|
||||
sponsoringOrganizationId: string,
|
||||
isAdminInitiated: boolean = false,
|
||||
): Promise<void> {
|
||||
const basePath = "/organization/sponsorship/";
|
||||
const hostPath = this.platformUtilsService.isSelfHost() ? "self-hosted/" : "";
|
||||
const queryParam = `?isAdminInitiated=${isAdminInitiated}`;
|
||||
|
||||
return await this.apiService.send(
|
||||
"DELETE",
|
||||
basePath + hostPath + sponsoringOrganizationId + queryParam,
|
||||
null,
|
||||
true,
|
||||
false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1621,18 +1621,6 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
return new OrganizationSponsorshipSyncStatusResponse(response);
|
||||
}
|
||||
|
||||
async deleteRevokeSponsorship(sponsoringOrganizationId: string): Promise<void> {
|
||||
return await this.send(
|
||||
"DELETE",
|
||||
"/organization/sponsorship/" +
|
||||
(this.platformUtilsService.isSelfHost() ? "self-hosted/" : "") +
|
||||
sponsoringOrganizationId,
|
||||
null,
|
||||
true,
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
async deleteRemoveSponsorship(sponsoringOrgId: string): Promise<void> {
|
||||
return await this.send(
|
||||
"DELETE",
|
||||
|
||||
Reference in New Issue
Block a user