summaryrefslogtreecommitdiff
path: root/src/store.js
blob: e4caede0504fbbdd81ef1d56dc01f05d3648a2e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import autoMergeLevel2 from 'redux-persist/lib/stateReconciler/autoMergeLevel2';
import { persistReducer, persistStore } from 'redux-persist';
import { composeWithDevTools } from 'redux-devtools-extension';
import { applyMiddleware, createStore } from 'redux';
import storage from 'redux-persist/lib/storage';
import rootReducer from './redux/reducers';
import thunk from 'redux-thunk';

const persistedReducers = persistReducer(
  {
    key: 'githunt:root',
    storage: storage,
    stateReconciler: autoMergeLevel2,
  },
  rootReducer,
);

export const store = createStore(persistedReducers, composeWithDevTools(
  applyMiddleware(
    thunk,
  ),
));

export const persist = persistStore(store);