mnml/client/src/reducers.jsx
2018-10-16 00:47:18 +11:00

71 lines
1.4 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 defaultCryps = null;
function crypsReducer(state = defaultCryps, action) {
switch (action.type) {
case actions.SET_CRYPS:
return action.value;
default:
return state;
}
}
const defaultItems = null;
function itemsReducer(state = defaultItems, action) {
switch (action.type) {
case actions.SET_ITEMS:
return action.value;
default:
return state;
}
}
const defaultActiveItem = null;
function activeItemReducer(state = defaultActiveItem, action) {
switch (action.type) {
case actions.SET_ACTIVE_ITEM:
return action.value;
default:
return state;
}
}
const defaultBattle = null;
function battleReducer(state = defaultBattle, action) {
switch (action.type) {
case actions.SET_BATTLE:
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;
}
}
module.exports = {
activeItemReducer,
battleReducer,
accountReducer,
crypsReducer,
itemsReducer,
wsReducer,
};