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.
trezor-wallet/src/js/reducers/LogReducer.js

51 lines
918 B

6 years ago
/* @flow */
'use strict';
import * as LOG from '../actions/constants/log';
import type { Action } from '~/flowtype';
6 years ago
export type LogEntry = {
6 years ago
time: number;
type: string;
6 years ago
// message: string;
message: any;
6 years ago
}
export type State = {
opened: boolean;
entries: Array<LogEntry>;
}
export const initialState: State = {
opened: false,
entries: [],
};
export default (state: State = initialState, action: Action): State => {
6 years ago
switch (action.type) {
6 years ago
case LOG.OPEN :
6 years ago
return {
...state,
opened: true
}
6 years ago
case LOG.CLOSE :
6 years ago
return {
...state,
opened: false
}
6 years ago
case LOG.ADD :
return {
...state,
entries: state.entries.concat([ action.payload ])
}
6 years ago
default:
return state;
}
}