e87390adb9
* update eslint and dependencies, fix linting errors that can be fixed with --fix * fix lots of linting errors * update eslintrc, fix some linting errors * fix all server side linting errors, untested * fix errors that fixing linting errors had caused * fix client side eslint errors * fix client side linting errors * fix refs lint errors * fix more linting errors * update eslint and dependencies, fix linting errors that can be fixed with --fix * fix lots of linting errors * update eslintrc, fix some linting errors * fix all server side linting errors, untested * fix errors that fixing linting errors had caused * fix client side eslint errors * fix client side linting errors * fix refs lint errors * fix more linting errors * fix some accessibility linting errors * fix a lot of linting errors * fix a billion more linting errors * hopefully fix all linting errors, still need to test * fix bugs that fixing linting had caused
24 lines
564 B
JavaScript
24 lines
564 B
JavaScript
import * as ActionTypes from '../../../constants';
|
|
|
|
const consoleMax = 200;
|
|
const initialState = [];
|
|
let messageId = 0;
|
|
|
|
const console = (state = initialState, action) => {
|
|
let messages;
|
|
switch (action.type) {
|
|
case ActionTypes.CONSOLE_EVENT:
|
|
messages = [...action.event];
|
|
messages.forEach((message) => {
|
|
message.id = messageId;
|
|
messageId += 1;
|
|
});
|
|
return state.concat(messages).slice(-consoleMax);
|
|
case ActionTypes.CLEAR_CONSOLE:
|
|
return [];
|
|
default:
|
|
return state;
|
|
}
|
|
};
|
|
|
|
export default console;
|