Home Reference Source

application/redux/reducers/upload-cart-reducers.js

import Immutable from 'immutable';
import {
    UPLOAD_CART_SET_ITEMS
} from './../actions/upload-cart-actions';

export function uploadCart(state = null, action) {
    if (state === null) {
        state = {
            items: Immutable.fromJS([]).toList(),
            selected: null
        };
    }

    switch (action.type) {
        case UPLOAD_CART_SET_ITEMS:
            return Object.assign({}, state, {
                items: action.payload
            });
    }

    return state;
};