fleet/frontend/redux/nodes/notifications/reducer.js
Mike Arpaia c07702330d Cleaning JavaScript imports and if statements (#327)
* Moving entityGetter to utility folder

* Import whitespace and if statement braces

* newlines between multi-line if's
2016-10-19 16:22:18 -04:00

29 lines
620 B
JavaScript

import { LOCATION_CHANGE } from 'react-router-redux';
import { RENDER_FLASH, HIDE_FLASH } from './actions';
export const initialState = {
alertType: null,
isVisible: false,
message: null,
undoAction: null,
};
export default (state = initialState, { type, payload }) => {
switch (type) {
case RENDER_FLASH:
return {
alertType: payload.alertType,
isVisible: true,
message: payload.message,
undoAction: payload.undoAction,
};
case HIDE_FLASH:
case LOCATION_CHANGE:
return {
...initialState,
};
default:
return state;
}
};