UNPKG

1.18 kBJavaScriptView Raw
1import { browserHistory } from 'react-router'
2import { routerReducer, routerMiddleware } from 'react-router-redux'
3import thunk from 'redux-thunk'
4import {
5 reducer as realtimeLocationReducer,
6 REALTIME_LOCATION_REDUCER_NAME,
7} from './realtime-location'
8import { SERVER_REDUCER_NAME, serverReducer } from '../ReactApp/server/redux'
9import {
10 reducerLocaleId as i18nReducerLocaleId,
11 reducerLocales as i18nReducerLocales,
12} from '../i18n/redux'
13
14//
15
16/**
17 * @type {Array}
18 */
19export const reducers = {
20 // 路由状态扩展
21 'routing': routerReducer,
22 // 目的:新页面请求处理完成后再改变URL
23 [REALTIME_LOCATION_REDUCER_NAME]: realtimeLocationReducer,
24 // 对应服务器生成的store
25 [SERVER_REDUCER_NAME]: serverReducer,
26}
27if (JSON.parse(process.env.KOOT_I18N) || false) {
28 reducers.localeId = i18nReducerLocaleId
29 reducers.locales = i18nReducerLocales
30}
31
32//
33
34/**
35 * @type {Object}
36 */
37export let initialState = {}
38if (__CLIENT__) initialState = window.__REDUX_STATE__
39
40//
41
42/**
43 * @type {Array}
44 */
45export const middlewares = [
46 thunk,
47 routerMiddleware(browserHistory),
48]