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

31 lines
1.1 KiB
JavaScript
Raw Normal View History

/*!
* Copyright (c) 2024 PLANKA Software GmbH
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
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 { createRouterMiddleware } from './lib/redux-router';
2019-08-31 04:07:25 +05:00
import rootReducer from './reducers';
import rootSaga from './sagas';
import history from './history';
2019-08-31 04:07:25 +05:00
const sagaMiddleware = createSagaMiddleware();
const middlewares = [sagaMiddleware, createRouterMiddleware(history)];
2019-08-31 04:07:25 +05:00
let compose = reduxCompose;
if (import.meta.env.DEV) {
middlewares.push(require('redux-logger')); // eslint-disable-line global-require
// 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
}
export default createStore(rootReducer, compose(applyMiddleware(...middlewares)));
2019-08-31 04:07:25 +05:00
sagaMiddleware.run(rootSaga);