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

export const getPoultryRequestsTotalQuantityService = createAsyncThunk(
  "GET_POULTRY_REQUESTS_TOTAL_QUANTITY",
  async (d, { dispatch }) => {
    d = d || moment(new Date()).format("YYYY-MM-DD");
    dispatch(LOADING_START());
    const { data, status } = await axios.get(
      "total_poultry_request_quantity/",
      { params: { date: d } }
    );
    dispatch(LOADING_END());

    return { data, status };
  }
);
