-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathreducer.js
77 lines (74 loc) · 1.83 KB
/
reducer.js
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import {
HC_PARAM_ACTION,
HC_DONE_SWITCH,
PRESENT_REPO,
GIT_TRACKED_FILES,
GIT_GLOBAL_REPOID,
GIT_ACTION_TRACKED_FILES,
GIT_ACTION_UNTRACKED_FILES,
DELETE_PRESENT_REPO,
ADD_FORM_CLOSE,
} from "./actionStore";
export default function reducer(state, action) {
switch (action.type) {
case HC_DONE_SWITCH:
return {
...state,
hcDone: action.payload,
};
case HC_PARAM_ACTION:
const { os, gitconvex } = action.payload;
localStorage.setItem("OS_TYPE", os);
localStorage.setItem("GIT_VERSION", gitconvex);
return {
...state,
hcParams: {
osCheck: os,
gitCheck: gitconvex,
},
};
case PRESENT_REPO:
return {
...state,
presentRepo: [...state.presentRepo, action.payload],
};
case ADD_FORM_CLOSE:
return {
...state,
shouldAddFormClose: action.payload,
};
case DELETE_PRESENT_REPO:
return {
...state,
presentRepo: [...action.payload],
};
case GIT_TRACKED_FILES:
state.modifiedGitFiles = [];
return {
...state,
modifiedGitFiles: [...state.modifiedGitFiles, action.payload],
};
case GIT_GLOBAL_REPOID:
state.globalRepoId = "";
return {
...state,
globalRepoId: action.payload,
};
case GIT_ACTION_TRACKED_FILES:
state.gitTrackedFiles = [];
return {
...state,
gitTrackedFiles: [...state.gitTrackedFiles, action.payload],
};
case GIT_ACTION_UNTRACKED_FILES:
state.gitUntrackedFiles = [];
return {
...state,
gitUntrackedFiles: [...state.gitUntrackedFiles, action.payload],
};
default:
return {
...state,
};
}
}