bookbrainz/bookbrainz-site

View on GitHub
src/client/unified-form/detail-tab/reducer.ts

Summary

Maintainability
A
1 hr
Test Coverage
import {ADD_EDITION_GROUP, CLEAR_EDITION_GROUPS} from './action';
import Immutable from 'immutable';


export default function editionGroupsReducer(state = Immutable.Map({}), {type, payload}) {
    switch (type) {
        case ADD_EDITION_GROUP:
            return state.set(payload.id, Immutable.fromJS(payload.value));
        case CLEAR_EDITION_GROUPS:
            return Immutable.Map({});
        default:
            return state;
    }
}