refetch when you post a comment

This commit is contained in:
Riley Davis
2017-01-24 12:13:56 -07:00
parent 0994023864
commit d977c33cf5
4 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -132,7 +132,7 @@ class Comment extends React.Component {
{
this.state.replyBoxVisible
? <ReplyBox
replyPostedHandler={() => {
commentPostedHandler={() => {
console.log('replyPostedHandler');
this.setState({replyBoxVisible: false});
refetch();
+1 -1
View File
@@ -120,7 +120,7 @@ class Embed extends Component {
{
user
? <CommentBox
refetch={refetch}
commentPostedHandler={refetch}
addNotification={this.props.addNotification}
postItem={this.props.postItem}
appendItemArray={this.props.appendItemArray}
+4 -4
View File
@@ -11,7 +11,7 @@ class CommentBox extends Component {
// updateItem: PropTypes.func,
// comments: PropTypes.array,
replyPostedHandler: PropTypes.func,
commentPostedHandler: PropTypes.func,
postItem: PropTypes.func.isRequired,
assetId: PropTypes.string.isRequired,
parentId: PropTypes.string,
@@ -32,7 +32,7 @@ class CommentBox extends Component {
// child_id,
// updateItem,
// appendItemArray,
replyPostedHandler,
commentPostedHandler,
postItem,
assetId,
parentId,
@@ -79,8 +79,8 @@ class CommentBox extends Component {
addNotification('success', 'Your comment has been posted.');
}
if (replyPostedHandler) {
replyPostedHandler();
if (commentPostedHandler) {
commentPostedHandler();
}
})
.catch((err) => console.error(err));
+3 -3
View File
@@ -3,10 +3,10 @@ import CommentBox from '../coral-plugin-commentbox/CommentBox';
const name = 'coral-plugin-replies';
const ReplyBox = ({styles, postItem, assetId, authorId, addNotification, parentId, replyPostedHandler}) => (
const ReplyBox = ({styles, postItem, assetId, authorId, addNotification, parentId, commentPostedHandler}) => (
<div className={`${name}-textarea`} style={styles && styles.container}>
<CommentBox
replyPostedHandler={replyPostedHandler}
commentPostedHandler={commentPostedHandler}
parentId={parentId}
addNotification={addNotification}
authorId={authorId}
@@ -17,7 +17,7 @@ const ReplyBox = ({styles, postItem, assetId, authorId, addNotification, parentI
);
ReplyBox.propTypes = {
replyPostedHandler: PropTypes.func,
commentPostedHandler: PropTypes.func,
parentId: PropTypes.string,
addNotification: PropTypes.func.isRequired,
authorId: PropTypes.string.isRequired,