-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathindex.js
43 lines (38 loc) · 1.12 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import './index.scss';
import * as storage from 'redux-storage'
import App from './components';
import React from 'react';
import ReactDOM from 'react-dom';
import createEngine from 'redux-storage-engine-indexed-db';
import filter from 'redux-storage-decorator-filter';
import rootReducer from './reducers/';
import thunk from 'redux-thunk';
import { ActionTypes } from './config/constants';
import { Provider } from 'react-redux';
import { applyMiddleware, createStore } from 'redux';
const reducer = storage.reducer(rootReducer);
const engine = filter(createEngine('tickets'), [
['tickets', 'nested'],
['tickets', 'flattened'],
]);
// Actions that trigger an IndexedDB update
const engineActions = [
ActionTypes.TICKETS_REMOVE,
ActionTypes.TICKETS_UPDATE,
];
const store = createStore(
reducer,
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(),
applyMiddleware(
thunk,
storage.createMiddleware(engine, [], engineActions),
),
);
const load = storage.createLoader(engine);
load(store);
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
);