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

const intialState = {
  uploadImageDatasource: [
    {
      imagePath: "",
      stepTitle: "",
      imageSize: "",
      upLoadStatus: "0",
    },
  ],
};
const clearState = {
  uploadImageDatasource: [
    {
      imagePath: "",
      stepTitle: "",
      imageSize: "",
      upLoadStatus: "0",
    },
  ],
};

export default (state = intialState, action) => {
  switch (action.type) {
    case UPLOAD_IMAGE_DATA:
      return {
        ...state,
        uploadImageDatasource: [...state.uploadImageDatasource, action.payload],
      };
    case "CLEAR_UPLOAD_IMAGE_DATA_REDUX":
      return clearState;
    default:
      return state;
  }
};
