mirror of https://github.com/trezor/trezor-wallet
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.8 KiB
61 lines
1.8 KiB
/* @flow */
|
|
|
|
import { createStore, applyMiddleware, compose } from 'redux';
|
|
import { routerMiddleware } from 'react-router-redux';
|
|
import thunk from 'redux-thunk';
|
|
// import createHistory from 'history/createBrowserHistory';
|
|
// import { useRouterHistory } from 'react-router';
|
|
import createHistory from 'history/createHashHistory';
|
|
import reducers from 'reducers';
|
|
import services from 'services';
|
|
|
|
import Raven from 'raven-js';
|
|
import RavenMiddleware from 'redux-raven-middleware';
|
|
|
|
// import type { Action, GetState, Store } from 'flowtype';
|
|
|
|
export const history: History = createHistory({ queryKey: false });
|
|
|
|
const RAVEN_KEY: string = 'https://497392c3ff6e46dc9e54eef123979378@sentry.io/294339';
|
|
Raven.config(RAVEN_KEY).install();
|
|
|
|
const initialState: any = {};
|
|
const enhancers = [];
|
|
const middleware = [
|
|
thunk,
|
|
RavenMiddleware(RAVEN_KEY),
|
|
routerMiddleware(history),
|
|
];
|
|
|
|
|
|
let composedEnhancers: any;
|
|
if (process.env.NODE_ENV === 'development') {
|
|
// const excludeLogger = (getState: GetState, action: Action): boolean => {
|
|
// //'@@router/LOCATION_CHANGE'
|
|
// const excluded: Array<string> = ['LOG_TO_EXCLUDE', 'log__add'];
|
|
// const pass: Array<string> = excluded.filter(act => action.type === act);
|
|
// return pass.length === 0;
|
|
// };
|
|
|
|
composedEnhancers = compose(
|
|
applyMiddleware(...middleware, ...services),
|
|
...enhancers,
|
|
);
|
|
} else {
|
|
composedEnhancers = compose(
|
|
applyMiddleware(...middleware, ...services),
|
|
...enhancers,
|
|
);
|
|
}
|
|
|
|
export default createStore(
|
|
reducers,
|
|
initialState,
|
|
composedEnhancers,
|
|
);
|
|
|
|
// if (process.env.NODE_ENV === 'production') {
|
|
// module.exports = require('./store.dev'); // eslint-disable-line global-require
|
|
// } else {
|
|
// module.exports = require('./store.dev'); // eslint-disable-line global-require
|
|
// }
|