mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 19:27:52 +01:00
29 lines
756 B
TypeScript
29 lines
756 B
TypeScript
import { connect } from 'react-redux';
|
|
|
|
import { requestPost } from '../actions/requestPost';
|
|
import { changePostStatus } from '../actions/changePostStatus';
|
|
|
|
import { State } from '../reducers/rootReducer';
|
|
|
|
import PostP from '../components/Post/PostP';
|
|
|
|
const mapStateToProps = (state: State) => ({
|
|
post: state.currentPost,
|
|
});
|
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
requestPost(postId: number) {
|
|
dispatch(requestPost(postId));
|
|
},
|
|
|
|
changePostStatus(postId: number, newPostStatusId: number, authenticityToken: string) {
|
|
if (isNaN(newPostStatusId)) newPostStatusId = null;
|
|
|
|
dispatch(changePostStatus(postId, newPostStatusId, authenticityToken));
|
|
},
|
|
});
|
|
|
|
export default connect(
|
|
mapStateToProps,
|
|
mapDispatchToProps,
|
|
)(PostP); |