import * as actionTypes from '../constants/actionTypes';
import initialState from "./initialState";

const invoicesReducer = (state = initialState.invoices, action) => 
{
	switch (action.type) 
	{
		case actionTypes.INVOICES_LIST: 
		{
			const shrink = {};
			shrink[ action.data.number ] = action.data.invoices;

			return {
				list: { ...state.list, ...shrink }, 
			};
		}

		default: {
			return state;
		}
	}
};

export default invoicesReducer;