1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +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 { ITreeNodeObject } from '../domain/treeNode';
import { CollectionGroupDetailsResponse } from '../response/collectionResponse';
export class CollectionView implements View, ITreeNodeObject {
id: string = null;
organizationId: string = null;
@ -10,14 +12,16 @@ export class CollectionView implements View, ITreeNodeObject {
externalId: string = null;
readOnly: boolean = null;
constructor(c?: Collection) {
constructor(c?: Collection | CollectionGroupDetailsResponse) {
if (!c) {
return;
}
this.id = c.id;
this.organizationId = c.organizationId;
this.readOnly = c.readOnly;
this.externalId = c.externalId;
if (c instanceof Collection) {
this.readOnly = c.readOnly;
}
}
}