UNPKG

generator-react-node

Version:

A kickstarter app generator for React and Node.js based application with redux, webpack, and babel

37 lines (27 loc) 894 B
import * as actionEvents from '../actions/index'; export function homePageReducer (state, action) { let actionType = action.type, newState = Object.assign({}, state); if (actionType === actionEvents.SET_PAGEDATA) { newState = action.payload; } return newState; } export function appState (state, action) { let actionType = action.type, newState = Object.assign({}, state); if (actionType === actionEvents.LOCATION_CHANGE) { newState.current.path = action.payload.pathname; } return newState; } export function dataRequests (state, action) { let actionType = action.type, newState = Object.assign({}, state); if (actionType === actionEvents.SETTING_PAGEDATA) { newState.settings = true; } else if (actionType === actionEvents.SET_PAGEDATA) { newState.settings = false; } return newState; }