blob: eeb0dfa34fdda27d6c7a1e92085694585623a978 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import React, { Component } from 'react'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import * as actions from '../actions'
import { Loader } from '../common'
import PaperInfo from './paper.info'
class PaperContainer extends Component {
componentDidMount() {
this.props.actions.getPaperInfo(this.props.match.params.key)
}
render() {
if (this.props.api.paperInfo.loading) return <Loader />
if (!this.props.api.paperInfo.dataset) return null
return (
<PaperInfo />
)
}
}
const mapStateToProps = state => ({
api: state.api,
})
const mapDispatchToProps = dispatch => ({
actions: bindActionCreators({ ...actions }, dispatch),
})
export default connect(mapStateToProps, mapDispatchToProps)(PaperContainer)
|