Skip to content

Instantly share code, notes, and snippets.

@asherccohen
Created April 26, 2019 08:32
Show Gist options
  • Save asherccohen/5ac219316dd67a963a98ba8b28e1b9ef to your computer and use it in GitHub Desktop.
Save asherccohen/5ac219316dd67a963a98ba8b28e1b9ef to your computer and use it in GitHub Desktop.
const INITIAL_STATE = {
orderList: {},
isRetrievingOrder: false,
errorRetrievingOrder: false,
errorRetrievingOrderMessage: null,
isSavingOrder: false,
errorSavingOrder: false,
errorSavingOrderMessage: null,
isCancellingOrder: false,
errorCancellingOrder: false,
errorCancellingOrderMessage: null,
};
export default (state = INITIAL_STATE, action) => {
switch (action.type) {
case RETRIEVE_ORDERS:
return {
...state,
isRetrievingOrder: true,
errorRetrievingOrder: false,
};
case RETRIEVE_ORDERS_SUCCESS: {
const savedOrders = action.payload;
//...do soemthing with your payload
return {
...state,
orderList,
isRetrievingOrder: false,
errorRetrievingOrder: false,
};
}
default:
return state;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment