Created
July 20, 2017 21:30
-
-
Save sfletche/a7d3bdcfa4f4f240f486352b3ca23923 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function showAllPlans(state = false, action = {}) { | |
switch (action.type) { | |
case TOGGLE_ALL_PLANS: | |
return action.showAllPlans; | |
default: | |
return state; | |
} | |
} | |
export function maxProjectAmounts(state = [], action = {}) { | |
switch (action.type) { | |
case RECEIVE_MAX_PROJECT_AMOUNTS: | |
return action.maxProjectAmounts; | |
case FETCH_MAX_PROJECT_AMOUNTS: | |
return []; | |
default: | |
return state; | |
} | |
} | |
export function pricingPlans(state = [], action = {}) { | |
switch (action.type) { | |
case RECEIVE_PRICING_PLANS: | |
return action.pricingPlans; | |
case FETCH_PRICING_PLANS: | |
return []; | |
default: | |
return state; | |
} | |
} | |
export function selectedOptionIdentifier(state = null, action = {}) { | |
switch (action.type) { | |
case RECEIVE_PRICING_PLANS: | |
if (state) { return state; } | |
return action.selectedOptionIdentifier || state; | |
case SELECT_OPTION_IDENTIFIER: | |
return action.selectedOptionIdentifier; | |
default: | |
return state; | |
} | |
} | |
export function error(state = {}, action = {}) { | |
switch (action.type) { | |
case RECEIVE_PRICING_PLANS_ERROR: | |
return { ...state, ...action.error }; | |
case FETCH_PRICING_PLANS: | |
return {}; | |
default: | |
return state; | |
} | |
} | |
export default combineReducers({ | |
showAllPlans, | |
maxProjectAmounts, | |
pricingPlans, | |
selectedOptionIdentifier, | |
error, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment