Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
save share response
Browse files Browse the repository at this point in the history
  • Loading branch information
kspearrin committed Oct 23, 2018
1 parent 2f510a7 commit 43c0cbc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/abstractions/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down
5 changes: 3 additions & 2 deletions src/services/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
5 changes: 3 additions & 2 deletions src/services/cipher.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down

0 comments on commit 43c0cbc

Please sign in to comment.