diff options
author | Jason <jason.daurus@gmail.com> | 2016-06-25 10:50:15 +0800 |
---|---|---|
committer | Jason <jason.daurus@gmail.com> | 2016-06-25 10:50:15 +0800 |
commit | db415a26bc22a903729a8064385923c32766da3c (patch) | |
tree | 7f941a159a6594f4f9805d4d68947354d89415bc /web/src | |
parent | a78257124477d8edb2bed03f146a73b1a1df6102 (diff) | |
download | mitmproxy-db415a26bc22a903729a8064385923c32766da3c.tar.gz mitmproxy-db415a26bc22a903729a8064385923c32766da3c.tar.bz2 mitmproxy-db415a26bc22a903729a8064385923c32766da3c.zip |
[web] log only in dev
Diffstat (limited to 'web/src')
-rw-r--r-- | web/src/js/app.jsx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/web/src/js/app.jsx b/web/src/js/app.jsx index 23297f63..bd2d3d58 100644 --- a/web/src/js/app.jsx +++ b/web/src/js/app.jsx @@ -2,8 +2,7 @@ import React from 'react' import { render } from 'react-dom' import { applyMiddleware, createStore } from 'redux' import { Provider } from 'react-redux' -import createLogger from 'redux-logger' -import thunkMiddleware from 'redux-thunk' +import thunk from 'redux-thunk' import { Route, Router as ReactRouter, hashHistory, Redirect } from 'react-router' import ProxyApp from './components/ProxyApp' @@ -11,10 +10,17 @@ import MainView from './components/MainView' import rootReducer from './ducks/index' import { add as addLog } from './ducks/eventLog' +const middlewares = [thunk]; + +if (process.env.NODE_ENV === 'development') { + const createLogger = require('redux-logger'); + middlewares.push(createLogger()); +} + // logger must be last const store = createStore( rootReducer, - applyMiddleware(thunkMiddleware, createLogger()) + applyMiddleware(...middlewares) ) // @todo move to ProxyApp |