import { ConfigActions } from '../model/config' ; import { SnackbarEvent , SnackbarEventAction , SnackbarEventActions } from '../model/snackbarEvent' ; import createReducer from './createReducer' ; export const snackbarEvents = createReducer < SnackbarEvent [ ] > ( [ ] , { [ SnackbarEventActions . ADD_SNACKBAR_EVENT ] ( state , action ) { return [ ... state , action . payload ] ; } , [ SnackbarEventActions . DELETE_SNACKBAR_EVENT ] ( state , action ) { return state . filter ( e => e . message !== action . payload . message ) ; } , [ SnackbarEventActions . PURGE_SNACKBARS ] ( state , action ) { return [ ] ; } , [ ConfigActions . PURGE_STATE ] ( state , action ) { return [ ] ; } , } ) ;