TopicsContainer.ts 765 B

1234567891011121314151617181920212223
  1. import { connect } from 'react-redux';
  2. import { fetchTopicList } from 'redux/actions';
  3. import Topics from './Topics';
  4. import { getIsTopicListFetched } from 'redux/reducers/topics/selectors';
  5. import { RootState, ClusterName } from 'redux/interfaces';
  6. import { RouteComponentProps } from 'react-router-dom';
  7. interface RouteProps {
  8. clusterName: ClusterName;
  9. }
  10. interface OwnProps extends RouteComponentProps<RouteProps> { }
  11. const mapStateToProps = (state: RootState, { match: { params: { clusterName } }}: OwnProps) => ({
  12. isFetched: getIsTopicListFetched(state),
  13. clusterName,
  14. });
  15. const mapDispatchToProps = {
  16. fetchTopicList: (clusterName: ClusterName) => fetchTopicList(clusterName),
  17. };
  18. export default connect(mapStateToProps, mapDispatchToProps)(Topics);