mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 05:43:41 +00:00
[PM-22344] - update response type for shareManyWithServer (#15061)
* update response type for shareManyWithServer * build new ListResponse
This commit is contained in:
@@ -208,7 +208,7 @@ export abstract class ApiService {
|
|||||||
deleteManyCiphersAdmin: (request: CipherBulkDeleteRequest) => Promise<any>;
|
deleteManyCiphersAdmin: (request: CipherBulkDeleteRequest) => Promise<any>;
|
||||||
putMoveCiphers: (request: CipherBulkMoveRequest) => Promise<any>;
|
putMoveCiphers: (request: CipherBulkMoveRequest) => Promise<any>;
|
||||||
putShareCipher: (id: string, request: CipherShareRequest) => Promise<CipherResponse>;
|
putShareCipher: (id: string, request: CipherShareRequest) => Promise<CipherResponse>;
|
||||||
putShareCiphers: (request: CipherBulkShareRequest) => Promise<CipherResponse[]>;
|
putShareCiphers: (request: CipherBulkShareRequest) => Promise<ListResponse<CipherResponse>>;
|
||||||
putCipherCollections: (
|
putCipherCollections: (
|
||||||
id: string,
|
id: string,
|
||||||
request: CipherCollectionsRequest,
|
request: CipherCollectionsRequest,
|
||||||
|
|||||||
@@ -532,8 +532,9 @@ export class ApiService implements ApiServiceAbstraction {
|
|||||||
return new CipherResponse(r);
|
return new CipherResponse(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
async putShareCiphers(request: CipherBulkShareRequest): Promise<CipherResponse[]> {
|
async putShareCiphers(request: CipherBulkShareRequest): Promise<ListResponse<CipherResponse>> {
|
||||||
return await this.send("PUT", "/ciphers/share", request, true, true);
|
const r = await this.send("PUT", "/ciphers/share", request, true, true);
|
||||||
|
return new ListResponse<CipherResponse>(r, CipherResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
async putCipherCollections(
|
async putCipherCollections(
|
||||||
|
|||||||
@@ -852,7 +852,7 @@ export class CipherService implements CipherServiceAbstraction {
|
|||||||
const request = new CipherBulkShareRequest(encCiphers, collectionIds, userId);
|
const request = new CipherBulkShareRequest(encCiphers, collectionIds, userId);
|
||||||
try {
|
try {
|
||||||
const response = await this.apiService.putShareCiphers(request);
|
const response = await this.apiService.putShareCiphers(request);
|
||||||
const responseMap = new Map(response.map((c) => [c.id, c]));
|
const responseMap = new Map(response.data.map((r) => [r.id, r]));
|
||||||
|
|
||||||
encCiphers.forEach((cipher) => {
|
encCiphers.forEach((cipher) => {
|
||||||
const matchingCipher = responseMap.get(cipher.id);
|
const matchingCipher = responseMap.get(cipher.id);
|
||||||
|
|||||||
Reference in New Issue
Block a user