Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function(state = initialState, action) {
console.log("state", state);
switch (action.type) {
case TOGGLE_CHANNEL:
const newState = {
...state,
channels: state.channels.map(c => channel(c, action))
};
// Side effect to link/unlink the channel
const cmd = Cmd.run(linkChannel, {
args: ["test"]
});
console.log("after cmd.run");
console.log("newState", newState);
return loop(newState, cmd);
default:
return state;
}
}
[Actions.longIncrementStart]: (state, amount) => {
console.log('long start');
return loop(state
.setIn(['long', 'loading'], true)
.setIn(['long', 'failed'], false),
Cmd.run(Api.longIncrement, {
successActionCreator: Actions.longIncrementSucceed,
failActionCreator: Actions.longIncrementFail,
args: [amount]
}))
},
[Actions.shortIncrementStart]: (state, amount) => {
console.log('short start');
return loop(state
.setIn(['short', 'loading'], true)
.setIn(['short', 'failed'], false),
Cmd.run(Api.shortIncrement, {
successActionCreator: Actions.shortIncrementSucceed,
failActionCreator: Actions.shortIncrementFail,
args: [amount]
})
)
},