UNPKG

716 BJavaScriptView Raw
1"use strict";
2
3exports.__esModule = true;
4exports.nodesReducer = void 0;
5const nodesReducer = (state = new Map(), action) => {
6 switch (action.type) {
7 case `DELETE_CACHE`:
8 return new Map();
9 case `CREATE_NODE`:
10 {
11 state.set(action.payload.id, action.payload);
12 return state;
13 }
14 case `ADD_FIELD_TO_NODE`:
15 case `ADD_CHILD_NODE_TO_PARENT_NODE`:
16 state.set(action.payload.id, action.payload);
17 return state;
18 case `DELETE_NODE`:
19 {
20 if (action.payload) {
21 state.delete(action.payload.id);
22 }
23 return state;
24 }
25 default:
26 return state;
27 }
28};
29exports.nodesReducer = nodesReducer;
30//# sourceMappingURL=nodes.js.map
\No newline at end of file