import find from 'lodash/find' ; import { Store , Dispatch , Middleware } from 'redux' ; const loggable = [ 'ADD_MANUAL_LANDMARK_REQUESTED' , 'REMOVE_MANUAL_LANDMARK_REQUESTED' , 'TOGGLE_ANALYSIS_RESULTS_REQUESTED' , ] ; const isLoggable = ( type ) => { return Boolean ( find ( loggable , type ) ) ; } ; const middleware = ( store ) => ( next ) => ( action ) => { const { type , payload } = action ; if ( isLoggable ( type ) ) { console . log ( 'It works!' , type , payload , store . getState ( ) ) ; } return next ( action ) ; } ; export default middleware ;