1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00

save share response

This commit is contained in:
Kyle Spearrin 2018-10-23 16:16:59 -04:00
parent 2f510a7988
commit 43c0cbce45
3 changed files with 7 additions and 5 deletions

View File

@ -141,7 +141,7 @@ export abstract class ApiService {
deleteCipherAdmin: (id: string) => Promise<any>;
deleteManyCiphers: (request: CipherBulkDeleteRequest) => Promise<any>;
putMoveCiphers: (request: CipherBulkMoveRequest) => Promise<any>;
putShareCipher: (id: string, request: CipherShareRequest) => Promise<any>;
putShareCipher: (id: string, request: CipherShareRequest) => Promise<CipherResponse>;
putShareCiphers: (request: CipherBulkShareRequest) => Promise<any>;
putCipherCollections: (id: string, request: CipherCollectionsRequest) => Promise<any>;
putCipherCollectionsAdmin: (id: string, request: CipherCollectionsRequest) => Promise<any>;

View File

@ -374,8 +374,9 @@ export class ApiService implements ApiServiceAbstraction {
return this.send('PUT', '/ciphers/move', request, true, false);
}
putShareCipher(id: string, request: CipherShareRequest): Promise<any> {
return this.send('PUT', '/ciphers/' + id + '/share', request, true, false);
async putShareCipher(id: string, request: CipherShareRequest): Promise<CipherResponse> {
const r = await this.send('PUT', '/ciphers/' + id + '/share', request, true, true);
return new CipherResponse(r);
}
putShareCiphers(request: CipherBulkShareRequest): Promise<any> {

View File

@ -465,9 +465,10 @@ export class CipherService implements CipherServiceAbstraction {
cipher.collectionIds = collectionIds;
const encCipher = await this.encrypt(cipher);
const request = new CipherShareRequest(encCipher);
await this.apiService.putShareCipher(cipher.id, request);
const response = await this.apiService.putShareCipher(cipher.id, request);
const userId = await this.userService.getUserId();
await this.upsert(encCipher.toCipherData(userId));
const data = new CipherData(response, userId, collectionIds);
await this.upsert(data);
}
async shareManyWithServer(ciphers: CipherView[], organizationId: string, collectionIds: string[]): Promise<any> {