|
| 1 | +import { applyMiddleware, createStore } from 'redux'; |
| 2 | +import { composeWithDevTools } from 'redux-devtools-extension'; // eslint-disable-line import/no-extraneous-dependencies |
| 3 | +import { createEpicMiddleware } from 'redux-observable'; |
| 4 | +/* local dependencies */ |
| 5 | +import rootReducer from './rootReducer'; |
| 6 | + |
| 7 | +/* local constants */ |
| 8 | +const epicMiddleware = createEpicMiddleware(); |
| 9 | + |
| 10 | +// fake data store |
| 11 | +const fakeStore = { |
| 12 | + filters: [ |
| 13 | + { group: 'phases', data: [{ name: 'Mitigation', count: 100, isActive: true }, { name: 'Preparedness', count: 20 }] }, |
| 14 | + { group: 'types', data: [] }, |
| 15 | + { group: 'roles', data: [] }, |
| 16 | + { group: 'functions', data: [] }, |
| 17 | + ], |
| 18 | + criteria: { |
| 19 | + filter: { |
| 20 | + $and: [{ phases: { $in: ['Mitigation'] } }, { types: { $in: ['Agency'] } }], |
| 21 | + }, |
| 22 | + }, |
| 23 | + contacts: { |
| 24 | + data: [ |
| 25 | + { name: 'Tanzania Red Cross Society', phone: '+233 54534545', email: '[email protected]' }, |
| 26 | + { name: 'Tanzania Red Cross Society', phone: '+233 54534545', email: '[email protected]' }, |
| 27 | + { name: 'Tanzania Red Cross Society', phone: '+233 54534545', email: '[email protected]' }, |
| 28 | + { name: 'Tanzania Red Cross Society', phone: '+233 54534545', email: '[email protected]' }, |
| 29 | + { name: 'Tanzania Red Cross Society', phone: '+233 54534545', email: '[email protected]' }, |
| 30 | + { name: 'Tanzania Red Cross Society', phone: '+233 54534545', email: '[email protected]' }, |
| 31 | + { name: 'Tanzania Red Cross Society', phone: '+233 54534545', email: '[email protected]' }, |
| 32 | + { name: 'Tanzania Red Cross Society', phone: '+233 54534545', email: '[email protected]' }, |
| 33 | + { name: 'Tanzania Red Cross Society', phone: '+233 54534545', email: '[email protected]' }, |
| 34 | + { name: 'Tanzania Red Cross Society', phone: '+233 54534545', email: '[email protected]' }, |
| 35 | + { name: 'Tanzania Red Cross Society', phone: '+233 54534545', email: '[email protected]' }, |
| 36 | + { name: 'Tanzania Red Cross Society', phone: '+233 54534545', email: '[email protected]' }, |
| 37 | + { name: 'Tanzania Red Cross Society', phone: '+233 54534545', email: '[email protected]' }, |
| 38 | + ], |
| 39 | + total: 100, |
| 40 | + }, |
| 41 | +}; |
| 42 | + |
| 43 | + |
| 44 | +/** |
| 45 | + * Configure Redux store |
| 46 | + * Enable redux dev tools |
| 47 | + * Setup redux observables as async library |
| 48 | + * |
| 49 | + * @function |
| 50 | + * @name configureStore |
| 51 | + * |
| 52 | + * @version 0.1.0 |
| 53 | + * @since 0.1.0 |
| 54 | + */ |
| 55 | +const configureStore = () => { |
| 56 | + const store = createStore(rootReducer, fakeStore, composeWithDevTools( |
| 57 | + applyMiddleware(epicMiddleware), |
| 58 | + )); |
| 59 | + |
| 60 | + // createEpicMiddleware.run(); add root epics here |
| 61 | + |
| 62 | + return store; |
| 63 | +}; |
| 64 | + |
| 65 | + |
| 66 | +export default configureStore; |
0 commit comments