LeftMenu.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import React, { Component, Fragment } from 'react';
  2. import { connect } from 'react-redux';
  3. import * as actions from "../actions/categoryAction";
  4. import { bindActionCreators } from "redux";
  5. import CategoryMenu from '../components/LeftMenu';
  6. class LeftMenu extends Component {
  7. componentWillMount() {
  8. this.props.getCategoriesData();
  9. // this.props.getAllCategory()
  10. }
  11. render() {
  12. const { allCategory, mainCategory, podCategory, isAdmin, getUser } = this.props
  13. return (
  14. <Fragment>
  15. <CategoryMenu allCategory={allCategory.data}
  16. mainCategory={mainCategory}
  17. podCategory={podCategory}
  18. isAdmin = { isAdmin }
  19. getUser={ getUser }
  20. />
  21. </Fragment>
  22. );
  23. }
  24. }
  25. const mapStateToProps = state => ({
  26. allCategory: state.category.allCategory,
  27. mainCategory: state.category.mainCategory,
  28. isFetching: state.category.isFetching,
  29. });
  30. const mapDispatchToProps = dispatch => bindActionCreators({ ...actions }, dispatch);
  31. export default LeftMenu = connect(
  32. mapStateToProps,
  33. mapDispatchToProps
  34. )(LeftMenu);