application/redux/reducers/snackbar-reducers.js
import _ from 'lodash';
import Immutable from 'immutable';
import {
SNACKBAR_SHOW_MESSAGE,
SNACKBAR_CLOSE
} from './../actions/snackbar-actions';
export function snackbar(state = null, action) {
if (state === null) {
state = {
open: false,
message: ''
};
}
switch (action.type) {
case SNACKBAR_SHOW_MESSAGE:
return Object.assign({}, state, {
open: true,
message: action.payload.message,
duration: action.payload.duration
});
case SNACKBAR_CLOSE:
return Object.assign({}, state, {
open: false
});
}
return state;
};