import { types } from "../actions/actionTypes";

const initialState = {
  homeOnSaleData: {
    data: {},
  },

  onSaleData: {
    data: {},
  },

  copiedCategoryInfos: [],
};

export const onSaleReducer = (state = initialState, action) => {
  switch (action.type) {
    case types.GET_HOME_ON_SALE_INFO:
      return {
        ...state,
        homeOnSaleData: action.payload,
      };

    case types.GET_ON_SALE_INFO:
      return {
        ...state,
        onSaleData: action.payload,
      };

    case types.COPY_CATEGORY_INFO:
      return {
        ...state,
        copiedCategoryInfos: action.payload,
      };

    case types.RESET_ON_SALE_STATE:
      return {
        ...state,
        onSaleData: {
          data: {},
        },
        // copiedCategoryInfos: [],
      };

    default:
      return state;
  }
};
