Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit ac2b3f8

Browse files
fix: DEV-2993: Edit and Delete options are missing for Comments section (#112)
1 parent 93a439a commit ac2b3f8

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/sdk/api-config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,11 @@ export const APIConfig = {
152152
path: "/../comments/:id",
153153
method: "patch",
154154
},
155+
156+
/** Update a comment **/
157+
deleteComment: {
158+
path: "/../comments/:id",
159+
method: "delete",
160+
},
155161
},
156162
};

src/sdk/comments-sdk.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ export class CommentsSdk {
1111
[
1212
'comments:create',
1313
'comments:update',
14+
'comments:delete',
1415
'comments:list',
1516
].forEach((evt) => this.lsf.off(evt));
1617

1718
this.lsf.on("comments:create", this.createComment);
1819
this.lsf.on("comments:update", this.updateComment);
20+
this.lsf.on("comments:delete", this.deleteComment);
1921
this.lsf.on("comments:list", this.listComments);
2022
}
2123

@@ -73,5 +75,13 @@ export class CommentsSdk {
7375

7476
return comments;
7577
}
78+
79+
deleteComment = async (comment) => {
80+
if (!comment.id || comment.id < 0) return; // Don't allow an update with an incorrect id
81+
82+
const res = await this.dm.apiCall("deleteComment", { id: comment.id }, { body: comment });
83+
84+
return res;
85+
}
7686
}
7787

0 commit comments

Comments
 (0)