Adding delete comment

- Fixes #9
This commit is contained in:
Dessalines 2019-03-28 23:03:17 -07:00
parent 6f1ba67e40
commit db1fd88870

View file

@ -267,6 +267,11 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
<span class="pointer" onClick={linkEvent(this, this.handleEditClick)}>edit</span>
</li>
}
{this.myComment &&
<li className="list-inline-item">
<span class="pointer" onClick={linkEvent(this, this.handleDeleteClick)}>delete</span>
</li>
}
<li className="list-inline-item">
<a className="text-muted" href="test">link</a>
</li>
@ -294,6 +299,17 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
i.setState(i.state);
}
handleDeleteClick(i: CommentNode, event) {
let deleteForm: CommentFormI = {
content: "*deleted*",
edit_id: i.props.node.comment.id,
post_id: i.props.node.comment.post_id,
parent_id: i.props.node.comment.parent_id,
auth: null
};
WebSocketService.Instance.editComment(deleteForm);
}
handleReplyCancel(): any {
this.state.showReply = false;
this.state.showEdit = false;