mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-10 11:05:47 +00:00
45 lines
981 B
JavaScript
45 lines
981 B
JavaScript
import React, {Component} from 'react'
|
|
import {connect} from 'react-redux'
|
|
import DashboardComponent from './components'
|
|
import {GET_STATISTICS} from 'actions/dashboard'
|
|
|
|
class Dashboard extends Component {
|
|
constructor(props) {
|
|
super(props)
|
|
}
|
|
|
|
static propTypes = {
|
|
statistics: React.PropTypes.array,
|
|
getStatistics: React.PropTypes.func.isRequired
|
|
}
|
|
|
|
componentDidMount() {
|
|
this.props.getStatistics()
|
|
}
|
|
|
|
render() {
|
|
|
|
let {statistics} = this.props
|
|
let props = {statistics}
|
|
|
|
return (
|
|
<DashboardComponent {...props}/>
|
|
)
|
|
}
|
|
}
|
|
|
|
function mapStateToProps(state) {
|
|
return {statistics: state.dashboard.statistics}
|
|
}
|
|
|
|
function mapDispatchToProps(dispatch) {
|
|
return {
|
|
getStatistics: async () => {
|
|
let result = await dispatch(GET_STATISTICS)
|
|
dispatch(result)
|
|
}
|
|
}
|
|
}
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Dashboard)
|