summaryrefslogtreecommitdiff
path: root/buildscripts/libdeps/graph_visualizer_web_stack/src/redux/graphPaths.js
blob: 135c9c30e32a3521c8db8e7770342b1eb75984c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { initialState } from "./store";

export const graphPaths = (state = initialState, action) => {
  switch (action.type) {
    case "selectedGraphPaths":
      return action.payload;
    case "setSelectedPath":
      const newState = { ...state, selectedPath: action.payload };
      return newState;
    default:
      return state;
  }
};

export const selectedGraphPaths = (pathData) => ({
  type: "selectedGraphPaths",
  payload: pathData,
});

export const setSelectedPath = (path) => ({
  type: "setSelectedPath",
  payload: path,
});