1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-24 23:59:48 +02:00
planka/client/src/store.js
Maksim Eltyshev 2ee1166747 feat: Version 2
Closes #627, closes #1047
2025-05-10 02:09:06 +02:00

30 lines
1.1 KiB
JavaScript
Executable file

/*!
* Copyright (c) 2024 PLANKA Software GmbH
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
import { applyMiddleware, legacy_createStore as createStore, compose as reduxCompose } from 'redux';
import createSagaMiddleware from 'redux-saga';
import { createRouterMiddleware } from './lib/redux-router';
import rootReducer from './reducers';
import rootSaga from './sagas';
import history from './history';
const sagaMiddleware = createSagaMiddleware();
const middlewares = [sagaMiddleware, createRouterMiddleware(history)];
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__;
}
}
export default createStore(rootReducer, compose(applyMiddleware(...middlewares)));
sagaMiddleware.run(rootSaga);