Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
raw
history blame
718 Bytes
import React from 'react';
import agent from '../../agent';
import { connect } from 'react-redux';
import { DELETE_COMMENT } from '../../constants/actionTypes';
const mapDispatchToProps = dispatch => ({
onClick: (payload, commentId) =>
dispatch({ type: DELETE_COMMENT, payload, commentId })
});
const DeleteButton = props => {
const del = () => {
const payload = agent.Comments.delete(props.slug, props.commentId);
props.onClick(payload, props.commentId);
};
if (props.show) {
return (
<span className="mod-options">
<i className="ion-trash-a" onClick={del}></i>
</span>
);
}
return null;
};
export default connect(() => ({}), mapDispatchToProps)(DeleteButton);