Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const config = {
key: 'root',
storage,
blacklist: ['loadingReducer'],
debug: true //to get useful logging
};
const middleware = [];
const sagaMiddleware = createSagaMiddleware();
middleware.push(sagaMiddleware);
if (__DEV__) {
middleware.push(createLogger());
}
const reducers = persistCombineReducers(config, rootReducers);
const enhancers = [applyMiddleware(...middleware)];
// const initialState = {};
const persistConfig = { enhancers };
let store = createStore(reducers, undefined, compose(...enhancers));
const persistor = persistStore(store, persistConfig, () => {
// console.log('Test', store.getState());
});
const configureStore = () => {
return { persistor, store };
};
sagaMiddleware.run(sagas);
export default configureStore;
key: 'root',
storage,
blacklist: [
'navbar',
'search',
'toastr',
'categories',
'products',
'reviews',
'variations',
'cart',
],
// debug: true,
};
const rootReducer = persistCombineReducers(rootPersistConfig, {
categories: persistReducer(
{
key: 'categories',
storage,
blacklist: config.OFFLINE ? ['isFetching', 'hasMore'] : ['isFetching', 'hasMore', 'items'],
},
categories,
),
products: persistReducer(
{
key: 'products',
storage,
blacklist: config.OFFLINE ? ['isFetching', 'hasMore'] : ['isFetching', 'hasMore', 'items'],
},
products,
),
import storage from 'redux-persist/lib/storage';
import createSagaMiddleware from 'redux-saga';
import reducers from 'reducers';
import sagas from 'sagas';
let middlewares;
let store;
const sagaMiddleware = createSagaMiddleware();
const config = {
key: 'root',
storage,
whitelist: ['PERSIST'],
};
const reducer = persistCombineReducers(config, reducers);
/* global __DEV__ */
if (__DEV__) {
const excludedActions = [];
const logger = createLogger({
collapsed: true,
predicate: (getState, action) => excludedActions.indexOf(action.type) < 0,
});
middlewares = applyMiddleware(sagaMiddleware, logger);
} else {
middlewares = applyMiddleware(sagaMiddleware);
}
export const getStore = () => store;
const configureStore = () => {
export default navigationService => {
const persistConfig = {
key: "rootReducer",
storage,
whitelist: ["gameHistory", "levels", "settings"],
version: 1
};
const persistedReducer = persistCombineReducers(persistConfig, {
gameHistory,
levels,
settings
});
const dependencies = {
navigationService
};
const epicMiddleware = createEpicMiddleware({dependencies});
const middlewares = [epicMiddleware];
if (isDebug()) {
middlewares.push(require("redux-logger").default);
}
const store = createStore(persistedReducer, applyMiddleware(...middlewares));
import CartFarmReducer from "./CartFarmReducer";
import TransactionReducer from "./TransactionReducer";
import FarmerBankReducer from "./FarmerBankReducer";
import PoolReducer from "./PoolReducer";
import HeaderTextReducer from "./HeaderTextReducer";
import Web3Reducer from "./Web3Reducer";
import { persistCombineReducers } from 'redux-persist'
import storage from 'redux-persist/es/storage'
const config = {
key: 'root',
storage,
}
export const reducer = persistCombineReducers(config, {
user: UserReducer,
pools: PoolFarmReducer,
products: CartFarmReducer,
transactions: TransactionReducer,
loans: FarmerBankReducer,
admin: PoolReducer,
header: HeaderTextReducer,
web3: Web3Reducer
})
import { History } from './history.types';
import prices from './prices';
import { Prices } from './prices.types';
import settings from './settings';
import { SettingsType } from './settings.types';
import ticker from './ticker';
import { Ticker } from './ticker.types';
import timers from './timer';
import { Timers } from './timer.types';
import trades from './trades';
import { TradesMap } from './trades.types';
import wallets from './wallets';
import { Wallets } from './wallets.types';
const config = configureReduxPersist();
export const rootReducer = persistCombineReducers(config, {
coinlist,
exchanges,
form,
history,
router,
prices,
settings,
ticker,
timers,
trades,
wallets,
} as any);
export interface GlobalState {
coinlist: Coinlist;
exchanges: Exchanges;
import * as storage from 'localforage'
import { applyMiddleware, compose, createStore, Middleware, Store } from 'redux'
import { createMigrate, persistCombineReducers, Persistor, persistStore } from 'redux-persist'
import migrations from 'store/migrations'
import reducers, { ApplicationState } from 'store/reducers'
/**
* Combined & persisted reducers.
*/
const persistedReducers = persistCombineReducers(
{
key: 'YaTA:store',
migrate: createMigrate(migrations as any, { debug: false }),
storage,
version: 41,
whitelist: ['settings', 'user', 'notes'],
},
reducers
)
/**
* Creates and configures the Redux Store.
* @return The Redux store configuration containing the actual store and the persistor.
*/
export default function configureStore(): StoreConfiguration {
const middlewares: Middleware[] = []
export default function makeRootReducer(config) {
return persistCombineReducers(config, {
frames,
connection,
query,
ui,
url,
});
}
import { createStore, applyMiddleware } from 'redux'
import thunkMiddleware from 'redux-thunk'
import { persistStore, persistCombineReducers } from 'redux-persist'
import { reducers } from '../reducers'
import localForage from 'localforage'
const config = {
key: 'cozy-bar',
storage: localForage,
whitelist: ['locale', 'apps']
}
const reducer = persistCombineReducers(config, { ...reducers })
const createReduxStore = () => {
let store = createStore(
reducer,
applyMiddleware(thunkMiddleware)
)
persistStore(store)
return store
}
export default createReduxStore
import { persistStore, persistCombineReducers } from 'redux-persist'
import storage from 'redux-persist/es/storage'
import CreateSagaMiddleware, { END } from 'redux-saga'
import { routerReducer, routerMiddleware } from 'react-router-redux'
import createHistory from 'history/createBrowserHistory'
import { createLogger } from 'redux-logger'
//import DevTools from '../containers/DevTools/DevTools'
import reducers from '../reducers'
const config = {
key: 'root',
storage,
debug: true
}
const reducer = persistCombineReducers(config, {
...reducers,
router: routerReducer
})
export default function configureStore(initialState) {
const sagaMiddleware = CreateSagaMiddleware()
const history = createHistory()
const routeMiddleware = routerMiddleware(history)
const loggerMiddleware = createLogger()
const middlewares = [routeMiddleware, sagaMiddleware, loggerMiddleware]
const enhancers = compose(
applyMiddleware(...middlewares),
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
//DevTools.instrument(),
)
const store = createStore(reducer, initialState, enhancers)