Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/sdk/api-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,11 @@ export const APIConfig = {
path: "/../comments/:id",
method: "patch",
},

/** Update a comment **/
deleteComment: {
path: "/../comments/:id",
method: "delete",
},
},
};
10 changes: 10 additions & 0 deletions src/sdk/comments-sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ export class CommentsSdk {
[
'comments:create',
'comments:update',
'comments:delete',
'comments:list',
].forEach((evt) => this.lsf.off(evt));

this.lsf.on("comments:create", this.createComment);
this.lsf.on("comments:update", this.updateComment);
this.lsf.on("comments:delete", this.deleteComment);
this.lsf.on("comments:list", this.listComments);
}

Expand Down Expand Up @@ -73,5 +75,13 @@ export class CommentsSdk {

return comments;
}

deleteComment = async (comment) => {
if (!comment.id || comment.id < 0) return; // Don't allow an update with an incorrect id

const res = await this.dm.apiCall("deleteComment", { id: comment.id }, { body: comment });

return res;
}
}