Update NewsFeed to use statusFeed url

pull/10616/head
Jared Scheib 2017-06-13 16:42:05 -07:00
parent b031dd5a78
commit c2f0af7e37
1 changed files with 5 additions and 7 deletions

View File

@ -44,34 +44,32 @@ class NewsFeed extends Component {
// TODO: implement interval polling a la AutoRefresh // TODO: implement interval polling a la AutoRefresh
componentDidMount() { componentDidMount() {
const {source, fetchJSONFeed} = this.props const {statusFeedURL, fetchJSONFeed} = this.props
fetchJSONFeed(source.links.status) fetchJSONFeed(statusFeedURL)
} }
} }
const {bool, func, shape, string} = PropTypes const {bool, func, shape, string} = PropTypes
NewsFeed.propTypes = { NewsFeed.propTypes = {
source: shape({
links: shape({
status: string.isRequired,
}).isRequired,
}).isRequired,
hasCompletedFetchOnce: bool.isRequired, hasCompletedFetchOnce: bool.isRequired,
isFetching: bool.isRequired, isFetching: bool.isRequired,
isFailed: bool.isRequired, isFailed: bool.isRequired,
data: shape(), data: shape(),
fetchJSONFeed: func.isRequired, fetchJSONFeed: func.isRequired,
statusFeedURL: string,
} }
const mapStateToProps = ({ const mapStateToProps = ({
links: {external: {statusFeed: statusFeedURL}},
JSONFeed: {hasCompletedFetchOnce, isFetching, isFailed, data}, JSONFeed: {hasCompletedFetchOnce, isFetching, isFailed, data},
}) => ({ }) => ({
hasCompletedFetchOnce, hasCompletedFetchOnce,
isFetching, isFetching,
isFailed, isFailed,
data, data,
statusFeedURL,
}) })
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({