drinkingvideogames/mixer

View on GitHub
src/reducers/genres.js

Summary

Maintainability
A
1 hr
Test Coverage
import { List, Map } from 'immutable'
import constants from '../actions/constants'
 
const init = List([])
 
const genre = (state, action) => {
switch (action.type) {
case constants.genre.ADD.SUCCESS:
return Map({ name: action.name })
default:
return state
}
}
 
Similar blocks of code found in 2 locations. Consider refactoring.
const genres = (state = init, action) => {
switch (action.type) {
case constants.genre.ADD.SUCCESS:
return state.push(genre(undefined, action))
default:
return state
}
}
 
export default genres