Skip to content

Commit

Permalink
[ACS-5994] perform node deletion in order (#9357)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-web-ua authored Feb 19, 2024
1 parent 34a399e commit d7fa414
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/js-api/src/api/content-rest-api/api/nodes.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,16 @@ export class NodesApi extends BaseApi {
* Only the owner of the node or an admin can permanently delete the node. (default to false)
* @returns Promise<[]>
*/
deleteNodes(nodeIds: string[], opts?: { permanent?: boolean }): Promise<void[]> {
async deleteNodes(nodeIds: string[], opts?: { permanent?: boolean }): Promise<void[]> {
throwIfNotDefined(nodeIds, 'nodeIds');

return Promise.all(nodeIds.map((id) => this.deleteNode(id, opts)));
const promises = [];

for (const id of nodeIds) {
promises.push(await this.deleteNode(id, opts));
}

return Promise.all(promises);
}

/**
Expand Down

0 comments on commit d7fa414

Please sign in to comment.