import { connect } from 'react-redux';
import { StoreState } from 'store/rootReducer';

import blog from 'store/blog';
import Permissions, { StateProps, DispatchProps, OwnProps } from './Permissions';

const mapStateToProps = (state: StoreState): {} => ({
  detail: state.blog.detail,
});

const mapDispatchToProps = {
  loadPerm: blog.actions.loadPermission.request.action,
  addPerm: blog.actions.addPermission.request.action,
  removePerm: blog.actions.removePermission.request.action,
};

const Wrapped = connect<StateProps, DispatchProps, OwnProps>(
  mapStateToProps,
  mapDispatchToProps,
)(Permissions);

export default Wrapped;
