addEditCipherInfo w/ collections from state

This commit is contained in:
Kyle Spearrin 2019-06-24 21:12:34 -04:00
parent bc5a6e02c1
commit 24ffb55ce0
1 changed files with 17 additions and 10 deletions

View File

@ -162,8 +162,13 @@ export class AddEditComponent implements OnInit {
this.title = this.i18nService.t('addItem');
}
this.cipher = await this.stateService.get<CipherView>('addEditCipher');
await this.stateService.remove('addEditCipher');
const addEditCipherInfo: any = await this.stateService.get<any>('addEditCipherInfo');
if (addEditCipherInfo != null) {
this.cipher = addEditCipherInfo.cipher;
this.collectionIds = addEditCipherInfo.collectionIds;
}
await this.stateService.remove('addEditCipherInfo');
if (this.cipher == null) {
if (this.editMode) {
const cipher = await this.loadCipher();
@ -179,7 +184,10 @@ export class AddEditComponent implements OnInit {
this.cipher.identity = new IdentityView();
this.cipher.secureNote = new SecureNoteView();
this.cipher.secureNote.type = SecureNoteType.Generic;
}
}
if (this.cipher != null && (!this.editMode || addEditCipherInfo != null)) {
await this.organizationChanged();
if (this.collectionIds != null && this.collectionIds.length > 0 && this.collections.length > 0) {
this.collections.forEach((c) => {
@ -189,7 +197,6 @@ export class AddEditComponent implements OnInit {
});
}
}
}
this.folders = await this.folderService.getAllDecrypted();
}