2018-12-17 22:03:36 +03:00
|
|
|
import ReduxThunk from 'redux-thunk';
|
|
|
|
import { applyMiddleware, compose, createStore } from 'redux';
|
2020-04-26 20:04:17 +03:00
|
|
|
import { save, load } from '@shlinkio/redux-localstorage-simple';
|
2018-12-17 22:03:36 +03:00
|
|
|
import reducers from '../reducers';
|
|
|
|
|
|
|
|
const composeEnhancers = process.env.NODE_ENV !== 'production' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
|
|
|
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
|
|
|
: compose;
|
|
|
|
|
2020-04-26 20:04:17 +03:00
|
|
|
const localStorageConfig = {
|
|
|
|
states: [ 'settings' ],
|
|
|
|
namespace: 'shlink',
|
|
|
|
namespaceSeparator: '.',
|
|
|
|
};
|
|
|
|
|
|
|
|
const store = createStore(reducers, load(localStorageConfig), composeEnhancers(
|
|
|
|
applyMiddleware(save(localStorageConfig), ReduxThunk)
|
2018-12-17 22:03:36 +03:00
|
|
|
));
|
|
|
|
|
|
|
|
export default store;
|