-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathreducer.js
More file actions
91 lines (87 loc) · 1.87 KB
/
reducer.js
File metadata and controls
91 lines (87 loc) · 1.87 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* global neveDash */
import { getTabHash } from '../utils/common';
const initialState = {
settings: {},
plugins: neveDash.plugins || {},
toast: null,
currentTab: 'start',
license: neveDash.pro ? neveDash.license : {},
notifications: neveDash.notifications || {},
obfxModuleStatus: neveDash.orbitFox?.data?.module_status || {},
};
const hash = getTabHash();
if (null !== hash) {
initialState.currentTab = hash;
}
const reducer = (state = initialState, action) => {
switch (action.type) {
case 'SET_TAB':
const { tab } = action.payload;
return {
...state,
currentTab: tab,
};
case 'SET_SETTINGS':
const { object } = action.payload;
return {
...state,
settings: object,
};
case 'SET_PLUGIN_STATE':
const { pluginSlug, pluginState } = action.payload;
const nextPlugins = { ...state.plugins };
nextPlugins[pluginSlug].cta = pluginState;
return {
...state,
plugins: nextPlugins,
};
case 'TOGGLE_MODULE':
const { moduleSlug, value } = action.payload;
return {
...state,
settings: {
...state.settings,
[moduleSlug]: value,
},
};
case 'CHANGE_MODULE_OPTION':
const { optionStatus, optionValue } = action.payload;
return {
...state,
settings: {
...state.settings,
[optionStatus]: optionValue,
},
};
case 'UPDATE_LICENSE':
return {
...state,
license: action.payload.licenseData,
};
case 'UPDATE_TOAST_MESSAGE':
return {
...state,
toast: action.payload,
};
case 'SET_LOGGER_STATUS':
return {
...state,
settings: {
...state.settings,
neve_logger_flag: action.payload,
},
};
case 'SET_OBFX_MODULE_STATUS':
return {
...state,
obfxModuleStatus: {
...state.obfxModuleStatus,
[action.payload.slug]: {
active: action.payload.value,
},
},
};
}
return state;
};
export default reducer;