admin-on-rest-fr05t1k
Version:
A frontend Framework for building admin applications on top of REST services, using ES6, React and Material UI
17 lines (14 loc) • 458 B
JavaScript
import { TOGGLE_SIDEBAR, SET_SIDEBAR_VISIBILITY } from '../actions';
const defaultState = {
sidebarOpen: false,
};
export default (previousState = defaultState, { type, payload }) => {
switch (type) {
case TOGGLE_SIDEBAR:
return { ...previousState, sidebarOpen: !previousState.sidebarOpen };
case SET_SIDEBAR_VISIBILITY:
return { ...previousState, sidebarOpen: payload };
default:
return previousState;
}
};