2018-02-25 00:17:04 +01:00
|
|
|
import React from 'react'
|
|
|
|
|
2019-03-27 22:00:57 +01:00
|
|
|
import { connect } from 'react-redux'
|
2018-02-25 00:17:04 +01:00
|
|
|
|
|
|
|
import { startClock } from '../lib/clock/actions'
|
|
|
|
import { countIncrease } from '../lib/count/actions'
|
|
|
|
import { loadData } from '../lib/placeholder/actions'
|
|
|
|
|
|
|
|
import App from '../components/App'
|
|
|
|
import Header from '../components/Header'
|
|
|
|
import Page from '../components/Page'
|
|
|
|
|
|
|
|
class PageIndex extends React.Component {
|
2019-03-27 22:00:57 +01:00
|
|
|
static async getInitialProps ({ ctx: { store } }) {
|
2018-02-25 00:17:04 +01:00
|
|
|
store.dispatch(countIncrease())
|
|
|
|
if (!store.getState().placeholder.data) {
|
|
|
|
store.dispatch(loadData())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount () {
|
|
|
|
this.props.dispatch(startClock())
|
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
return (
|
|
|
|
<App>
|
|
|
|
<Header />
|
|
|
|
<Page title='Home Page' />
|
|
|
|
</App>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-27 22:00:57 +01:00
|
|
|
export default connect()(PageIndex)
|