1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-24 09:18:09 +00:00

filter log

This commit is contained in:
Szymon Lesisz 2018-05-22 20:06:05 +02:00
parent 241fc5acdc
commit 053b12d3ff

View File

@ -5,6 +5,7 @@ import * as LogActions from '../actions/LogActions';
import * as STORAGE from '../actions/constants/localStorage'; import * as STORAGE from '../actions/constants/localStorage';
import * as SEND from '../actions/constants/send'; import * as SEND from '../actions/constants/send';
import { OPEN, CLOSE, ADD } from '../actions/constants/log'; import { OPEN, CLOSE, ADD } from '../actions/constants/log';
import { TRANSPORT, DEVICE } from 'trezor-connect';
import type { import type {
Middleware, Middleware,
@ -24,6 +25,12 @@ const exclude: Array<string> = [
"web3__create" "web3__create"
]; ];
const include: Array<string> = [
TRANSPORT.START,
DEVICE.CONNECT,
DEVICE.DISCONNECT
];
/** /**
* Middleware * Middleware
*/ */
@ -31,9 +38,15 @@ const LogService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispatch
next(action); next(action);
if (exclude.indexOf(action.type) < 0) { // if (exclude.indexOf(action.type) < 0) {
if (include.indexOf(action.type) >= 0) {
// api.dispatch(LogActions.add(action.type, JSON.stringify( action ))); // api.dispatch(LogActions.add(action.type, JSON.stringify( action )));
api.dispatch(LogActions.add(action.type, action));
if (action.type === TRANSPORT.START) {
api.dispatch(LogActions.add('Transport', action.payload));
} else if (action.type === DEVICE.CONNECT) {
api.dispatch(LogActions.add(action.type, action));
}
} }
return action; return action;