2018-12-17 20:03:36 +01:00
|
|
|
import ReduxThunk from 'redux-thunk';
|
|
|
|
import { applyMiddleware, compose, createStore } from 'redux';
|
2020-04-26 19:04:17 +02:00
|
|
|
import { save, load } from '@shlinkio/redux-localstorage-simple';
|
2018-12-17 20:03:36 +01: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 19:04:17 +02:00
|
|
|
const localStorageConfig = {
|
2020-04-27 11:30:51 +02:00
|
|
|
states: [ 'settings', 'servers' ],
|
2020-04-26 19:04:17 +02:00
|
|
|
namespace: 'shlink',
|
|
|
|
namespaceSeparator: '.',
|
|
|
|
};
|
|
|
|
|
|
|
|
const store = createStore(reducers, load(localStorageConfig), composeEnhancers(
|
|
|
|
applyMiddleware(save(localStorageConfig), ReduxThunk)
|
2018-12-17 20:03:36 +01:00
|
|
|
));
|
|
|
|
|
|
|
|
export default store;
|