import { createAsyncThunk } from "@reduxjs/toolkit";
import axios from "axios";
import { LOADING_END, LOADING_START } from "../../../lib/redux/slices/appSlice";

export const provinceGetProcessData = createAsyncThunk(
  "PROVINCE_GET_REPORT_PROCESS",
  async (d, { dispatch }) => {
    dispatch(LOADING_START());
    try {
      const { data, status } = await axios.get(
        `general_poultry_request_letter_report/?date=${d.selectedDate1}&type=${d.value}`
      );
      dispatch(LOADING_END());
      return { data, status };
    } catch (error) {
      dispatch(LOADING_END());
      throw error;
    }
  }
);
