import { createAsyncThunk } from "@reduxjs/toolkit";
import axios from "axios";
import { getRoleFromUrl } from "../../../utils/getRoleFromUrl";

export const avicultureGetRequests = createAsyncThunk(
  "AVICULTURE_REQUESTS_SERVICE",
  async (d, { dispatch }) => {
    const { data, status } = await axios.get(
      "Poultry_Request/?role=" + getRoleFromUrl(),
      {
        params: {
          date1: d.selectedDate1,
          date2: d.selectedDate2,
        },
      }
    );
    return { data, status };
  }
);
