2018-03-29 09:05:42 +00:00
|
|
|
// @flow
|
2018-03-12 08:30:03 +00:00
|
|
|
import 'babel-polyfill'
|
2018-03-29 09:05:42 +00:00
|
|
|
import { createBrowserHistory } from 'history'
|
2018-03-08 09:04:12 +00:00
|
|
|
import { MuiThemeProvider } from 'material-ui/styles'
|
2018-03-01 08:05:56 +00:00
|
|
|
import React from 'react'
|
|
|
|
import ReactDOM from 'react-dom'
|
2018-03-29 09:05:42 +00:00
|
|
|
import { Provider } from 'react-redux'
|
|
|
|
import { ConnectedRouter, routerMiddleware, routerReducer } from 'react-router-redux'
|
|
|
|
import { combineReducers, createStore, applyMiddleware, compose } from 'redux'
|
|
|
|
import thunk from 'redux-thunk'
|
|
|
|
import provider, { REDUCER_ID } from '~/wallets/store/reducer/provider'
|
2018-03-08 09:04:12 +00:00
|
|
|
import theme from '~/theme/mui'
|
2018-03-29 09:05:42 +00:00
|
|
|
import AppRoutes from '~/routes'
|
|
|
|
import './index.scss'
|
|
|
|
|
|
|
|
const history = createBrowserHistory()
|
|
|
|
// eslint-disable-next-line
|
|
|
|
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
|
|
|
|
const finalCreateStore = composeEnhancers(applyMiddleware(
|
|
|
|
thunk,
|
|
|
|
routerMiddleware(history),
|
|
|
|
))
|
|
|
|
|
|
|
|
const reducers = combineReducers({
|
|
|
|
routing: routerReducer,
|
|
|
|
[REDUCER_ID]: provider,
|
|
|
|
})
|
|
|
|
|
|
|
|
const store = createStore(reducers, finalCreateStore)
|
2018-03-02 16:53:50 +00:00
|
|
|
|
|
|
|
const Root = () => (
|
2018-03-29 09:05:42 +00:00
|
|
|
<Provider store={store}>
|
|
|
|
<MuiThemeProvider theme={theme}>
|
|
|
|
<ConnectedRouter history={history}>
|
|
|
|
<AppRoutes />
|
|
|
|
</ConnectedRouter>
|
|
|
|
</MuiThemeProvider>
|
|
|
|
</Provider>
|
2018-03-02 16:53:50 +00:00
|
|
|
)
|
2018-03-01 08:05:56 +00:00
|
|
|
|
|
|
|
ReactDOM.render(
|
2018-03-02 16:53:50 +00:00
|
|
|
<Root />,
|
2018-03-12 08:30:03 +00:00
|
|
|
document.getElementById('root'),
|
|
|
|
)
|