mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 03:37:56 +01:00
Add comment replies toggle and body to state
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { requestComments } from '../actions/requestComments';
|
||||
import {
|
||||
toggleCommentReply,
|
||||
setCommentReplyBody,
|
||||
} from '../actions/handleCommentReplies';
|
||||
|
||||
import { State } from '../reducers/rootReducer';
|
||||
|
||||
@@ -8,6 +12,7 @@ import CommentsP from '../components/Comments/CommentsP';
|
||||
|
||||
const mapStateToProps = (state: State) => ({
|
||||
comments: state.currentPost.comments.items,
|
||||
replies: state.currentPost.comments.replies,
|
||||
areLoading: state.currentPost.comments.areLoading,
|
||||
error: state.currentPost.comments.error,
|
||||
});
|
||||
@@ -16,6 +21,14 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
requestComments(postId: number) {
|
||||
dispatch(requestComments(postId));
|
||||
},
|
||||
|
||||
toggleCommentReply(commentId: number) {
|
||||
dispatch(toggleCommentReply(commentId));
|
||||
},
|
||||
|
||||
setCommentReplyBody(commentId: number, body: string) {
|
||||
dispatch(setCommentReplyBody(commentId, body));
|
||||
},
|
||||
});
|
||||
|
||||
export default connect(
|
||||
|
||||
Reference in New Issue
Block a user