mirror of
https://github.com/wassname/talk.git
synced 2026-07-19 11:28:50 +08:00
refetch when you post a comment
This commit is contained in:
@@ -132,7 +132,7 @@ class Comment extends React.Component {
|
||||
{
|
||||
this.state.replyBoxVisible
|
||||
? <ReplyBox
|
||||
replyPostedHandler={() => {
|
||||
commentPostedHandler={() => {
|
||||
console.log('replyPostedHandler');
|
||||
this.setState({replyBoxVisible: false});
|
||||
refetch();
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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,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,
|
||||
|
||||
Reference in New Issue
Block a user