Skip to content

Instantly share code, notes, and snippets.

@robrichard
Created September 20, 2016 14:29
Show Gist options
  • Save robrichard/78d2b464f78b4cc388ff1209ded3df4c to your computer and use it in GitHub Desktop.
Save robrichard/78d2b464f78b4cc388ff1209ded3df4c to your computer and use it in GitHub Desktop.
function (state = {}, action) {
switch (action.type) {
case 'VIEW_ORDERS':
return {
...state,
pageType: 'orders',
orderId: null
};
case 'VIEW_ORDER':
return {
...state,
pageType: 'order',
orderId: action.orderId
};
case 'VIEW_RECEIPT':
return {
...state,
pageType: 'receipt',
orderId: action.orderId
};
}
return state;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment