import React from 'react'; import { connect } from 'react-redux'; import { Input, Button, Form } from 'UI'; import { addMessage } from 'Duck/assignments'; class IssueCommentForm extends React.PureComponent { state = { comment: '' } write = (e) => { e.stopPropagation(); const { target: { name, value } } = e this.setState({ comment: value }); } addComment = () => { const { comment } = this.state; const { sessionId, issueId, addMessage, loading } = this.props; if (loading) return; addMessage(sessionId, issueId, { message: comment, type: 'message' }).then(() => { this.setState({comment: ''}); }) } render() { const { comment } = this.state; const { loading } = this.props; return (
Add Comment
); } }; export default connect(state => ({ loading: state.getIn(['assignments', 'addMessage', 'loading']) }), { addMessage })(IssueCommentForm)