Created
January 4, 2019 21:50
-
-
Save Jalson1982/1f2c72c6714e0d19f17e38030616f6ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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