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