ES6 Plato on Github
Report Home
Summary Display
reducers/logbook.js
Maintainability
63.23
Lines of code
34
Difficulty
19.77
Estimated Errors
0.10
Function weight
By Complexity
By SLOC
import { SET_LOGBOOK_CONTEXT } from '../constants/ActionTypes'; // initialize the logbook redux state const initialState = { context: { name: null, isReleased: null } }; /** * The logbook reducer. THe reducer takes the current state and the action and returns the new state */ const logbookReducer = (state = initialState, action) => { switch (action.type) { case SET_LOGBOOK_CONTEXT: { state = { ...state, context: { name: action.context.name, isReleased: action.context.isReleased } } break; } default: break; // leave the state unchanged when the action should have no impact on current logbook store state }; return state; }; export default logbookReducer;