1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

extend ctor for collection view

This commit is contained in:
Kyle Spearrin 2019-09-25 17:12:13 -04:00
parent 971e19335f
commit 53d08067df

View File

@ -3,6 +3,8 @@ import { View } from './view';
import { Collection } from '../domain/collection'; import { Collection } from '../domain/collection';
import { ITreeNodeObject } from '../domain/treeNode'; import { ITreeNodeObject } from '../domain/treeNode';
import { CollectionGroupDetailsResponse } from '../response/collectionResponse';
export class CollectionView implements View, ITreeNodeObject { export class CollectionView implements View, ITreeNodeObject {
id: string = null; id: string = null;
organizationId: string = null; organizationId: string = null;
@ -10,14 +12,16 @@ export class CollectionView implements View, ITreeNodeObject {
externalId: string = null; externalId: string = null;
readOnly: boolean = null; readOnly: boolean = null;
constructor(c?: Collection) { constructor(c?: Collection | CollectionGroupDetailsResponse) {
if (!c) { if (!c) {
return; return;
} }
this.id = c.id; this.id = c.id;
this.organizationId = c.organizationId; this.organizationId = c.organizationId;
this.readOnly = c.readOnly;
this.externalId = c.externalId; this.externalId = c.externalId;
if (c instanceof Collection) {
this.readOnly = c.readOnly;
}
} }
} }