2018-05-13 16:26:17 +00:00
|
|
|
import App, { Container } from 'next/app'
|
|
|
|
import React from 'react'
|
|
|
|
import { Provider } from 'react-redux'
|
|
|
|
import withRedux from 'next-redux-wrapper'
|
|
|
|
import withReduxSaga from 'next-redux-saga'
|
|
|
|
|
2018-05-16 08:47:12 +00:00
|
|
|
import createStore from '../store'
|
|
|
|
|
2018-05-13 16:26:17 +00:00
|
|
|
class MyApp extends App {
|
|
|
|
static async getInitialProps ({ Component, ctx }) {
|
|
|
|
let pageProps = {}
|
|
|
|
|
|
|
|
if (Component.getInitialProps) {
|
|
|
|
pageProps = await Component.getInitialProps({ ctx })
|
|
|
|
}
|
|
|
|
|
|
|
|
return { pageProps }
|
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
const { Component, pageProps, store } = this.props
|
|
|
|
return (
|
|
|
|
<Container>
|
|
|
|
<Provider store={store}>
|
|
|
|
<Component {...pageProps} />
|
|
|
|
</Provider>
|
|
|
|
</Container>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-14 18:05:27 +00:00
|
|
|
export default withRedux(createStore)(withReduxSaga(MyApp))
|