Skip to content

Instantly share code, notes, and snippets.

@twhid
Created September 20, 2016 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twhid/61c327fe6e4de098c6c1a0d8d256f89e to your computer and use it in GitHub Desktop.
Save twhid/61c327fe6e4de098c6c1a0d8d256f89e 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