Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function configureStore(initialState?: {}) {
// configure middlewares
const middlewares = [thunk, promise(), routerMiddleware(history)];
// compose enhancers
const enhancer = composeEnhancers(applyMiddleware(...middlewares));
// create store
return createStore(connectRouter(history)(rootReducer), persistedState || initialState!, enhancer);
}
const history = createHashHistory()
const middleware = [
thunk,
routerMiddleware(history) // for dispatching history actions
]
// check if app is being run in development mode. If so, enable redux-logger
if (process.env.NODE_ENV === 'development') {
middleware.push(createLogger())
}
// set up the Redux store
const store = createStore(
combineReducers({
otp: createOtpReducer(otpConfig),
router: connectRouter(history)
}),
compose(applyMiddleware(...middleware))
)
// define a simple responsive UI using Bootstrap and OTP-RR
class OtpRRExample extends Component {
render () {
/** desktop view **/
const desktopView = (
<div>
<div style="{{">
</div></div>
function createApp(): AppView {
const history = createBrowserHistory();
const actionStore = new ActionStore();
const sagaMiddleware = createSagaMiddleware();
const reducer: Reducer = rootReducer(connectRouter(history));
const store: Store = createStore(reducer, devtools(applyMiddleware(routerMiddleware(history), sagaMiddleware)));
store.subscribe(storeListener(store));
sagaMiddleware.run(saga, actionStore);
window.onerror = (message: string | Event, source?: string, line?: number, column?: number, error?: Error): void => {
console.error("Window Global Error");
console.error(`Message: ${message.toString()}`);
if (error) {
console.error(error);
}
if (source && line && column) {
console.error(`Source: ${source} (${line}, ${column})`);
}
if (!error) {
error = new Error(message.toString());
}
store.dispatch(setErrorAction(error));
export default history => combineReducers({
router: connectRouter(history),
})
module.hot.accept("Reducers", function() {
store.replaceReducer(connectRouter(history)(rootReducer))
})
if (module.hot) {
const configureStore = (): Store => {
const store: Store = createStore(connectRouter(history)(rootReducer), enhancer);
if (module.hot) {
module.hot.accept('@common/store', () => {
ipcRenderer.sendSync('renderer-reload');
import('@common/store')
.then(({ rootReducer }) => {
store.replaceReducer(connectRouter(history)(rootReducer) as any);
});
});
}
return store;
};
export default function createRootReducer(history: History) {
return combineReducers({
router: connectRouter(history),
accounts,
settings,
sidebar,
selectedFile,
files,
functionCallResults,
})
}
export default history => combineReducers({
router: connectRouter(history)
});
export default function createRootReducer(history) {
return combineReducers({
router: connectRouter(history),
fileLoader: fileLoader,
settings: settings,
console: console,
game: game,
errors: errors,
notifs: notifs
});
}