mnml/client/src/reducers.jsx
2019-04-05 13:49:10 +11:00

148 lines
3.3 KiB
JavaScript

const actions = require('./actions');
const defaultAccount = null;
function accountReducer(state = defaultAccount, action) {
switch (action.type) {
case actions.SET_ACCOUNT:
return action.value;
default:
return state;
}
}
const defaultActiveSkill = null;
function activeSkillReducer(state = defaultActiveSkill, action) {
switch (action.type) {
case actions.SET_ACTIVE_SKILL:
return action.value;
default:
return state;
}
}
const defaultActiveCryp = null;
function activeCrypReducer(state = defaultActiveCryp, action) {
switch (action.type) {
case actions.SET_ACTIVE_CRYP:
return action.value;
default:
return state;
}
}
const defaultCryps = null;
function crypsReducer(state = defaultCryps, action) {
switch (action.type) {
case actions.SET_CRYPS:
return action.value;
default:
return state;
}
}
const defaultInstances = null;
function instancesReducer(state = defaultInstances, action) {
switch (action.type) {
case actions.SET_INSTANCES:
return action.value;
default:
return state;
}
}
const defaultInstance = null;
function instanceReducer(state = defaultInstance, action) {
switch (action.type) {
case actions.SET_INSTANCE:
return action.value;
default:
return state;
}
}
const defaultSelectedCryps = [null, null, null];
function selectedCrypsReducer(state = defaultSelectedCryps, action) {
switch (action.type) {
case actions.SET_SELECTED_CRYPS:
return action.value;
default:
return state;
}
}
const defaultCombiner = [null, null, null];
function combinerReducer(state = defaultCombiner, action) {
switch (action.type) {
case actions.SET_COMBINER:
return action.value;
default:
return state;
}
}
const defaultGame = null;
function gameReducer(state = defaultGame, action) {
switch (action.type) {
case actions.SET_GAME:
return action.value;
default:
return state;
}
}
const defaultShowLog = false;
function showLogReducer(state = defaultShowLog, action) {
switch (action.type) {
case actions.SET_SHOW_LOG:
return action.value;
default:
return state;
}
}
const defaultReclaiming = false;
function reclaimingReducer(state = defaultReclaiming, action) {
switch (action.type) {
case actions.SET_RECLAIMING:
return action.value;
default:
return state;
}
}
const defaultWs = null;
function wsReducer(state = defaultWs, action) {
switch (action.type) {
case actions.SET_WS:
return action.value;
default:
return state;
}
}
const defaultInfo = [];
function infoReducer(state = defaultInfo, action) {
switch (action.type) {
case actions.SET_INFO:
return action.value;
default:
return state;
}
}
module.exports = {
accountReducer,
activeSkillReducer,
activeCrypReducer,
combinerReducer,
crypsReducer,
gameReducer,
showLogReducer,
instanceReducer,
instancesReducer,
reclaimingReducer,
selectedCrypsReducer,
wsReducer,
infoReducer,
};