Skip to content

Instantly share code, notes, and snippets.

@Jalson1982
Created January 4, 2019 21:50
Show Gist options
  • Save Jalson1982/1f2c72c6714e0d19f17e38030616f6ee to your computer and use it in GitHub Desktop.
Save Jalson1982/1f2c72c6714e0d19f17e38030616f6ee to your computer and use it in GitHub Desktop.
import {
SET_NEW_PICKER_ORDERS,
SET_ORDERS_IN_PACKING_PROCESS,
SET_ORDERS_IN_PICKING_PROCESS,
SET_ORDERS_READY_FOR_DELIVER,
SET_COMPLETED_ORDERS
} from "../constants";
const newOrdersInitialState = {
orders:[]
};
const ordersInPickingProcessInitialState = {
orders:[]
};
const ordersInPackingProcessInitialState = {
orders:[]
};
const ordersReadyForDeliveryInitialState = {
orders:[]
};
const completedOrdersInitialState = {
orders:[]
}
export const newOrdersReducer = (state = newOrdersInitialState, action) => {
switch (action.type) {
case SET_NEW_PICKER_ORDERS:
return {
...state,
orders:[...action.payload]
};
default:
return state;
}
};
export const ordersInPickingProcessReducer = (state = ordersInPickingProcessInitialState, action) => {
switch (action.type) {
case SET_ORDERS_IN_PICKING_PROCESS:
return {
...state,
orders:[...action.payload]
};
default:
return state;
}
};
export const ordersInPackingProcessReducer = (state = ordersInPackingProcessInitialState, action) => {
switch (action.type) {
case SET_ORDERS_IN_PACKING_PROCESS:
return {
...state,
orders:[...action.payload]
};
default:
return state;
}
};
export const ordersReadyForDeliveryReducer = (state = ordersReadyForDeliveryInitialState, action) => {
switch (action.type) {
case SET_ORDERS_READY_FOR_DELIVER:
return {
...state,
orders:action.payload
};
default:
return state;
}
};
export const completedOrdersReducer = (state = completedOrdersInitialState, action) => {
switch (action.type) {
case SET_COMPLETED_ORDERS:
return {
...state,
orders:action.payload
};
default:
return state;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment