1 | import React from 'react'
|
2 | import { render } from 'react-dom'
|
3 | import { createStore, applyMiddleware } from 'redux'
|
4 | import { Provider, connect } from 'react-redux'
|
5 | import { Map } from 'immutable'
|
6 | import AppLoader from './appLoader'
|
7 | import appMiddleware from './appMiddleware'
|
8 | import reducer from './reducer'
|
9 | import config from './config'
|
10 | import appFactory from './appFactory'
|
11 |
|
12 | export default function init() {
|
13 | const currentConfig = config.current
|
14 |
|
15 | if(currentConfig.apps)
|
16 | appFactory.registerApps(currentConfig.apps)
|
17 |
|
18 | var mw = [appMiddleware(currentConfig.actionInjections || {}, currentConfig.reducerInjections || {})]
|
19 |
|
20 | if (currentConfig.middlewares)
|
21 | mw = mw.concat(currentConfig.middlewares)
|
22 |
|
23 | const store = createStore(reducer, Map(), applyMiddleware(...mw))
|
24 |
|
25 | window.reduxStore = store
|
26 |
|
27 | } |
\ | No newline at end of file |