blob: d0d4713c9be9e3242b69f69735035aa86958afa4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import { initialState } from "./store";
export const graphFiles = (state = initialState, action) => {
switch (action.type) {
case "setGraphFiles":
return action.payload;
case "selectGraphFile":
const newState = state.map((graphFile, index) => {
if (action.payload.hash == graphFile.git) {
graphFile.selected = action.payload.selected;
} else {
graphFile.selected = false;
}
return graphFile;
});
return newState;
default:
return state;
}
};
export const setGraphFiles = (graphFiles) => ({
type: "setGraphFiles",
payload: graphFiles,
});
export const selectGraphFile = (graphFiles) => ({
type: "selectGraphFile",
payload: graphFiles,
});
|