mirror of
https://github.com/wassname/talk.git
synced 2026-09-10 12:43:11 +08:00
Containers
This commit is contained in:
@@ -1,16 +1,24 @@
|
||||
import React from 'react';
|
||||
import {withSetCommentStatus} from 'plugin-api/beta/client/hocs';
|
||||
import {compose} from 'react-apollo';
|
||||
import {bindActionCreators} from 'redux';
|
||||
import {getErrorMessages} from 'plugin-api/beta/client/utils';
|
||||
import {notify} from 'plugin-api/beta/client/actions/notification';
|
||||
import ApproveCommentAction from '../components/ApproveCommentAction';
|
||||
import {connect, withSetCommentStatus} from 'plugin-api/beta/client/hocs';
|
||||
|
||||
class ApproveCommentActionContainer extends React.Component {
|
||||
|
||||
approveComment = () => {
|
||||
const {setCommentStatus, comment} = this.props;
|
||||
|
||||
setCommentStatus({
|
||||
commentId: comment.id,
|
||||
status: 'ACCEPTED'
|
||||
});
|
||||
|
||||
try {
|
||||
setCommentStatus({
|
||||
commentId: comment.id,
|
||||
status: 'ACCEPTED'
|
||||
});
|
||||
} catch (err) {
|
||||
notify('error', getErrorMessages(err));
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -18,4 +26,14 @@ class ApproveCommentActionContainer extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default withSetCommentStatus(ApproveCommentActionContainer);
|
||||
const mapDispatchToProps = (dispatch) =>
|
||||
bindActionCreators({
|
||||
notify,
|
||||
}, dispatch);
|
||||
|
||||
const enhance = compose(
|
||||
connect(null, mapDispatchToProps),
|
||||
withSetCommentStatus
|
||||
);
|
||||
|
||||
export default enhance(ApproveCommentActionContainer);
|
||||
|
||||
@@ -1,16 +1,24 @@
|
||||
import React from 'react';
|
||||
import {withSetCommentStatus} from 'plugin-api/beta/client/hocs';
|
||||
import {compose} from 'react-apollo';
|
||||
import {bindActionCreators} from 'redux';
|
||||
import {getErrorMessages} from 'plugin-api/beta/client/utils';
|
||||
import {notify} from 'plugin-api/beta/client/actions/notification';
|
||||
import RejectCommentAction from '../components/RejectCommentAction';
|
||||
import {connect, withSetCommentStatus} from 'plugin-api/beta/client/hocs';
|
||||
|
||||
class RejectCommentActionContainer extends React.Component {
|
||||
|
||||
rejectComment = () => {
|
||||
approveComment = () => {
|
||||
const {setCommentStatus, comment} = this.props;
|
||||
|
||||
setCommentStatus({
|
||||
commentId: comment.id,
|
||||
status: 'REJECTED'
|
||||
});
|
||||
|
||||
try {
|
||||
setCommentStatus({
|
||||
commentId: comment.id,
|
||||
status: 'REJECTED'
|
||||
});
|
||||
} catch (err) {
|
||||
notify('error', getErrorMessages(err));
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -18,4 +26,14 @@ class RejectCommentActionContainer extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default withSetCommentStatus(RejectCommentActionContainer);
|
||||
const mapDispatchToProps = (dispatch) =>
|
||||
bindActionCreators({
|
||||
notify,
|
||||
}, dispatch);
|
||||
|
||||
const enhance = compose(
|
||||
connect(null, mapDispatchToProps),
|
||||
withSetCommentStatus
|
||||
);
|
||||
|
||||
export default enhance(RejectCommentActionContainer);
|
||||
|
||||
Reference in New Issue
Block a user