mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 03:37:56 +01:00
Add basic version of Comments component
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { requestPost } from '../actions/requestPost';
|
||||
import { requestComments } from '../actions/requestComments';
|
||||
import { changePostStatus } from '../actions/changePostStatus';
|
||||
|
||||
import { State } from '../reducers/rootReducer';
|
||||
@@ -8,7 +9,8 @@ import { State } from '../reducers/rootReducer';
|
||||
import PostP from '../components/Post/PostP';
|
||||
|
||||
const mapStateToProps = (state: State) => ({
|
||||
post: state.currentPost,
|
||||
post: state.currentPost.item,
|
||||
comments: state.currentPost.comments,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
@@ -16,6 +18,10 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
dispatch(requestPost(postId));
|
||||
},
|
||||
|
||||
requestComments(postId: number, page: number = 1) {
|
||||
dispatch(requestComments(postId, page));
|
||||
},
|
||||
|
||||
changePostStatus(postId: number, newPostStatusId: number, authenticityToken: string) {
|
||||
if (isNaN(newPostStatusId)) newPostStatusId = null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user