Skip to content

Instantly share code, notes, and snippets.

@emanueleDiVizio
Created June 9, 2020 15:14
Show Gist options
  • Save emanueleDiVizio/214601e595539ab5e151ed869227f8ba to your computer and use it in GitHub Desktop.
Save emanueleDiVizio/214601e595539ab5e151ed869227f8ba to your computer and use it in GitHub Desktop.
const productReducer = (state, action) => {
switch (action.type) {
case offlineActionTypes.FETCH_OFFLINE_MODE:
if (
action.payload.prevAction.type ===
actionTypes.FETCH_USER_SELECTED_PRODUCT_REQUEST
) {
return handleSelectedProductWhileOffline(state, action.payload);
}
return state;
case actionTypes.FETCH_USER_SELECTED_PRODUCT_REQUEST:
return handleSelectedProduct(state, action.payload);
default:
return state;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment