1 | import reducer from './reducers'
|
2 | import routes from './routes'
|
3 | import thunk from 'redux-thunk'
|
4 | import Helmet from 'react-helmet'
|
5 |
|
6 | //Have any top level css or images? Import them here
|
7 | //import './index.css';
|
8 |
|
9 | const config = {
|
10 | polyfills: 'default,fetch,Symbol,Symbol.iterator,Array.prototype.find',
|
11 | requestExtendedUserInfo: false,
|
12 | redux: {
|
13 | reducer: reducer,
|
14 | //initialState: {}
|
15 | middleware: [thunk]
|
16 | //enhancers: []
|
17 | //parseServerState: (serverState) => {
|
18 | // If you have any special parsing you need to do of the plain
|
19 | // plain JSON Object coming from the server you can do that here.
|
20 | // Useful for example for immutable libraries like Immutable.js
|
21 | //}
|
22 | },
|
23 | router: {
|
24 | routes: routes
|
25 | },
|
26 | head: {
|
27 | helmet: Helmet
|
28 | },
|
29 | init: env => {
|
30 | //you can do any custom initialization.
|
31 | //You have available the following objects on env:
|
32 | //req (request), userInfo, store, config & history
|
33 | }
|
34 | }
|
35 |
|
36 | export default config
|
37 |
|
38 | /*
|
39 | You are also able supply a function that creates a configuration file. The
|
40 | single argument is the environment the code is running in: 'CLIENT' or 'SERVER'
|
41 | */
|
42 |
|
43 | /*
|
44 | import thunk from 'redux-thunk'
|
45 | import { browserHistory } from 'react-router';
|
46 | import { routerMiddleware } from 'react-router-redux';
|
47 | import { persistStore, autoRehydrate } from 'redux-persist';
|
48 | import localForage from 'localforage';
|
49 | import rootReducer from './reducer/index';
|
50 | import routes from './framework/Routes'
|
51 |
|
52 | const config = (render_env) => {
|
53 | const logger = createLogger();
|
54 | const router = routerMiddleware(browserHistory);
|
55 |
|
56 | return {
|
57 | redux: {
|
58 | reducer: rootReducer,
|
59 | middleware: [thunk, router],
|
60 | enhancers: render_env === 'CLIENT' && [autoRehydrate()]
|
61 | },
|
62 | router: {
|
63 | routes: routes
|
64 | },
|
65 | head: {
|
66 | helmet: Helmet
|
67 | }
|
68 | init: (env) => {
|
69 | if(render_env === 'CLIENT') {
|
70 | const onComplete = () => { console.log("Rehydrate is complete!"); };
|
71 | persistStore(env.store, { storage: localForage }, onComplete);
|
72 | }
|
73 | }
|
74 | };
|
75 | }
|
76 |
|
77 |
|
78 |
|
79 | export default config
|
80 | */
|