1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-13 20:08:56 +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 SEND from '../actions/constants/send';
import { OPEN, CLOSE, ADD } from '../actions/constants/log';
import { TRANSPORT, DEVICE } from 'trezor-connect';
import type {
Middleware,
@ -24,6 +25,12 @@ const exclude: Array<string> = [
"web3__create"
];
const include: Array<string> = [
TRANSPORT.START,
DEVICE.CONNECT,
DEVICE.DISCONNECT
];
/**
* Middleware
*/
@ -31,9 +38,15 @@ const LogService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispatch
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, 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;