38 lines
1.7 KiB
JavaScript
38 lines
1.7 KiB
JavaScript
const actions = require('./actions');
|
|
|
|
function createReducer(defaultState, actionType) {
|
|
return function reducer(state = defaultState, action) {
|
|
switch (action.type) {
|
|
case actionType:
|
|
return action.value;
|
|
default:
|
|
return state;
|
|
}
|
|
};
|
|
}
|
|
|
|
/* eslint-disable key-spacing */
|
|
module.exports = {
|
|
account: createReducer(null, actions.SET_ACCOUNT),
|
|
activeCryp: createReducer(null, actions.SET_ACTIVE_CRYP),
|
|
activeSkill: createReducer(null, actions.SET_ACTIVE_SKILL),
|
|
activeVar: createReducer(null, actions.SET_ACTIVE_VAR),
|
|
combiner: createReducer([null, null, null], actions.SET_COMBINER),
|
|
cryps: createReducer([], actions.SET_CRYPS),
|
|
game: createReducer(null, actions.SET_GAME),
|
|
info: createReducer([null, null], actions.SET_INFO),
|
|
instance: createReducer(null, actions.SET_INSTANCE),
|
|
instances: createReducer([], actions.SET_INSTANCES),
|
|
nav: createReducer(null, actions.SET_NAV),
|
|
ping: createReducer(null, actions.SET_PING),
|
|
player: createReducer(null, actions.SET_PLAYER),
|
|
reclaiming: createReducer(false, actions.SET_RECLAIMING),
|
|
resolution: createReducer(null, actions.SET_RESOLUTION),
|
|
selectedCryps: createReducer([null, null, null], actions.SET_SELECTED_CRYPS),
|
|
showLog: createReducer(false, actions.SET_SHOW_LOG),
|
|
vboxHidden: createReducer(false, actions.SET_VBOX_HIDDEN),
|
|
vboxHighlight: createReducer([], actions.SET_VBOX_HIGHLIGHT),
|
|
vboxInfo: createReducer({ combos: [], vars: [] }, actions.SET_VBOX_INFO),
|
|
ws: createReducer(null, actions.SET_WS),
|
|
};
|