2017-07-13 18:55:29 +00:00
|
|
|
import React from 'react'
|
2018-05-13 16:26:17 +00:00
|
|
|
import {connect} from 'react-redux'
|
2018-05-16 08:47:12 +00:00
|
|
|
|
|
|
|
import {loadData, startClock, tickClock} from '../actions'
|
2017-07-13 18:55:29 +00:00
|
|
|
import Page from '../components/page'
|
|
|
|
|
2018-05-16 08:47:12 +00:00
|
|
|
class Index extends React.Component {
|
2018-05-13 16:26:17 +00:00
|
|
|
static async getInitialProps (props) {
|
2018-05-16 08:47:12 +00:00
|
|
|
const { store, isServer } = props.ctx
|
|
|
|
store.dispatch(tickClock(isServer))
|
2018-05-13 16:26:17 +00:00
|
|
|
|
2017-07-13 18:55:29 +00:00
|
|
|
if (!store.getState().placeholderData) {
|
|
|
|
store.dispatch(loadData())
|
|
|
|
}
|
2018-05-16 08:47:12 +00:00
|
|
|
|
|
|
|
return { isServer }
|
2017-07-13 18:55:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount () {
|
|
|
|
this.props.dispatch(startClock())
|
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
2018-05-16 08:47:12 +00:00
|
|
|
return <Page title='Index Page' linkTo='/other' NavigateTo='Other Page' />
|
2017-07-13 18:55:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-16 08:47:12 +00:00
|
|
|
export default connect()(Index)
|