blob: 9d47584b7f51256143b51fe55215d06a680782ba (
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
31
32
|
import { initialState } from "./store";
export const links = (state = initialState, action) => {
switch (action.type) {
case "addLink":
var arr = Object.assign(state);
return [...arr, action.payload];
case "setLinks":
return action.payload;
case "updateSelectedLinks":
var newState = Object.assign(state);
newState[action.payload.index].selected = action.payload.value;
return newState;
default:
return state;
}
};
export const addLink = (link) => ({
type: "addLink",
payload: link,
});
export const setLinks = (links) => ({
type: "setLinks",
payload: links,
});
export const updateSelectedLinks = (newValue) => ({
type: "updateSelectedLinks",
payload: newValue,
});
|