mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-24 09:18:09 +00:00
filter log
This commit is contained in:
parent
241fc5acdc
commit
053b12d3ff
@ -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,10 +38,16 @@ 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 )));
|
||||||
|
|
||||||
|
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));
|
api.dispatch(LogActions.add(action.type, action));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user