content: import React from 'react';
  import {get, has} from 'lodash';
  import PropTypes from 'prop-types';
  import {connect} from 'react-redux';
  import {Redirect} from 'react-router-dom'
  
  import Container from '../base/Container';
  import {findIssue} from '../actions/Github';
  
  class Article extends Container {
  
      componentWillMount() {
          const {match, dispatch} = this.props;
          const aid = get(match, 'params.id');
          if (aid) {
              findIssue(dispatch, aid);
          } else {
              return <Redirect to={{pathname: '404'}}/>;
          }
      }
  
      render() {
          const {match, issue} = this.props;
          const aid = get(match, 'params.id');
          const oid = get(issue, 'payload.number');
          if (!has(issue, 'code') || (oid && aid - oid !== 0)) {
              return this.loading();
          }
          if (issue.code) {
              return <div>{issue.payload}</div>;
          }
          let payload = get(issue, 'payload');
          return (
              <div>
                  <article>
                      <h2>{payload.title}</h2>
                      <section dangerouslySetInnerHTML={{__html: get(payload, 'bodyHTML')}}/>
                  </article>
              </div>
          );
      }
  }
  
  Article.propTypes = {
      issue: PropTypes.object.isRequired
  };
  
  export default connect(({issue}) => {
      return {issue};
  })(Article);