1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-30 18:49:44 +02:00
planka/client/src/store.js

32 lines
1,023 B
JavaScript
Raw Normal View History

2022-08-04 13:31:14 +02:00
import { applyMiddleware, legacy_createStore as createStore, compose as reduxCompose } from 'redux';
2019-08-31 04:07:25 +05:00
import createSagaMiddleware from 'redux-saga';
import rootReducer from './reducers';
import rootSaga from './sagas';
2022-11-21 00:54:05 +01:00
import { createReduxHistory, routerMiddleware } from './redux-history-context';
2019-08-31 04:07:25 +05:00
const sagaMiddleware = createSagaMiddleware();
2022-11-21 00:54:05 +01:00
const middlewares = [sagaMiddleware, routerMiddleware];
2019-08-31 04:07:25 +05:00
let compose = reduxCompose;
2019-08-31 04:07:25 +05:00
if (process.env.NODE_ENV !== 'production') {
const { logger } = require('redux-logger'); // eslint-disable-line global-require
middlewares.push(logger);
// Enable Redux Devtools in development
// https://github.com/zalmoxisus/redux-devtools-extension
if (typeof window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ !== 'undefined') {
compose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
}
2019-08-31 04:07:25 +05:00
}
2022-11-21 00:54:05 +01:00
const store = createStore(rootReducer, compose(applyMiddleware(...middlewares)));
2019-08-31 04:07:25 +05:00
sagaMiddleware.run(rootSaga);
2022-11-21 00:54:05 +01:00
export default store;
export const history = createReduxHistory(store);