mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
Introduce a stricter use of the OrganizationId type on org-vault exports (#15836)
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
68d7cb4846
commit
b091719748
@@ -1,8 +1,7 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
|
||||
import { isId, OrganizationId } from "@bitwarden/common/types/guid";
|
||||
import { ExportComponent } from "@bitwarden/vault-export-ui";
|
||||
|
||||
import { HeaderModule } from "../../layouts/header/header.module";
|
||||
@@ -13,18 +12,27 @@ import { SharedModule } from "../../shared";
|
||||
imports: [SharedModule, ExportComponent, HeaderModule],
|
||||
})
|
||||
export class OrganizationVaultExportComponent implements OnInit {
|
||||
protected routeOrgId: string = null;
|
||||
protected routeOrgId: OrganizationId | undefined = undefined;
|
||||
protected loading = false;
|
||||
protected disabled = false;
|
||||
|
||||
constructor(private route: ActivatedRoute) {}
|
||||
|
||||
async ngOnInit() {
|
||||
this.routeOrgId = this.route.snapshot.paramMap.get("organizationId");
|
||||
const orgIdParam = this.route.snapshot.paramMap.get("organizationId");
|
||||
if (orgIdParam === undefined) {
|
||||
throw new Error("`organizationId` is a required route parameter");
|
||||
}
|
||||
|
||||
if (!isId<OrganizationId>(orgIdParam)) {
|
||||
throw new Error("Invalid OrganizationId provided in route parameter `organizationId`");
|
||||
}
|
||||
|
||||
this.routeOrgId = orgIdParam;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback that is called after a successful export.
|
||||
*/
|
||||
protected async onSuccessfulExport(organizationId: string): Promise<void> {}
|
||||
protected async onSuccessfulExport(organizationId: OrganizationId): Promise<void> {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user