UNPKG

occsn-checkout

Version:

Occasion checkout experience boilerplate component built using React-Redux and Mitragyna

35 lines (30 loc) 1.12 kB
import Immutable from 'immutable'; import actionTypes from '../constants/appConstants'; export const $$initialState = Immutable.fromJS({ bookingOrder: false, order: null, product: null, savingOrder: false, skipAttendees: false }); export default function appReducer($$state = $$initialState, action) { const { type } = action; switch (type) { case actionTypes.OCCSN_BOOK_ORDER_REQUEST: return $$state.merge({ bookingOrder: true }); case actionTypes.OCCSN_BOOK_ORDER_REQUEST_COMPLETE: return $$state.merge({ bookingOrder: false }); case actionTypes.OCCSN_SAVE_ORDER_REQUEST: return $$state.merge({ savingOrder: true }); case actionTypes.OCCSN_SAVE_ORDER_REQUEST_COMPLETE: return $$state.merge({ savingOrder: false }); case actionTypes.OCCSN_SET_ORDER: return $$state.merge({ order: action.order }); case actionTypes.OCCSN_SET_PRODUCT: return $$state.merge({ product: action.product }); case actionTypes.OCCSN_SET_SKIP_ATTENDEES: return $$state.merge({ skipAttendees: action.skipAttendees }); default: return $$state; } }