Skip to content

Commit

Permalink
Fixed ts sctrict issue
Browse files Browse the repository at this point in the history
  • Loading branch information
gbubemismith committed Dec 24, 2024
1 parent e69e997 commit f64fb81
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions libs/vault/src/cipher-view/cipher-view.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { CommonModule } from "@angular/common";
import { Component, Input, OnChanges, OnDestroy } from "@angular/core";
import { firstValueFrom, map, Observable, Subject, takeUntil } from "rxjs";
Expand Down Expand Up @@ -49,21 +47,21 @@ import { ViewIdentitySectionsComponent } from "./view-identity-sections/view-ide
],
})
export class CipherViewComponent implements OnChanges, OnDestroy {
@Input({ required: true }) cipher: CipherView;
@Input({ required: true }) cipher!: CipherView;

private activeUserId$ = this.accountService.activeAccount$.pipe(map((a) => a?.id));

/**
* Optional list of collections the cipher is assigned to. If none are provided, they will be fetched using the
* `CipherService` and the `collectionIds` property of the cipher.
*/
@Input() collections: CollectionView[];
@Input() collections: CollectionView[] | undefined;

/** Should be set to true when the component is used within the Admin Console */
@Input() isAdminConsole?: boolean = false;

organization$: Observable<Organization>;
folder$: Observable<FolderView>;
organization$!: Observable<Organization | undefined>;
folder$!: Observable<FolderView | undefined>;
private destroyed$: Subject<void> = new Subject();
cardIsExpired: boolean = false;

Expand Down Expand Up @@ -129,6 +127,11 @@ export class CipherViewComponent implements OnChanges, OnDestroy {

if (this.cipher.folderId) {
const activeUserId = await firstValueFrom(this.activeUserId$);

if (!activeUserId) {
return;
}

this.folder$ = this.folderService
.getDecrypted$(this.cipher.folderId, activeUserId)
.pipe(takeUntil(this.destroyed$));
Expand Down

0 comments on commit f64fb81

Please sign in to comment.