headergroup.js
656 Bytes
const init_state = [
{ id: 1, name: "药库", initialPos: {x: 80, y: 70}, target_type: 'RegionalDesign::Repo' },
{ id: 2, name: "药架", initialPos: {x: 80, y: 70 + 60}, target_type: 'RegionalDesign::DrugRepo' },
{ id: 3, name: "药架格", initialPos: {x: 80, y: 70 + 60 * 2}, target_type: 'RegionalDesign::DrugBrandreth' }
]
const headergroup = (state = init_state, action) => {
switch (action.type) {
case 'CLONE_ELEMENT':
return [
...state,
action.element
]
case 'DELETE_LAST_ELEMENT':
return [
...state.slice(0, -1),
]
default:
return state
}
}
export default headergroup