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

export const ProvinceChickenDistributionsAndSalesDashboardService =
  createAsyncThunk(
    "PROVINCE_NATIONAL_GET_DISTRIBUTION_SERVICE",
    async (d, { dispatch }) => {
      dispatch(LOADING_START());
      const { data, status } = await axios.get(
        "https://rsibackend.rasadyar.com/app/transport-carcass-dashboard",
        {
          params: d,
        }
      );
      dispatch(LOADING_END());
      return { data, status };
    }
  );

export const ProvinceStewardChickenDistributionsAndSalesDashboardService =
  createAsyncThunk(
    "PROVINCE_NATIONAL_GET_STEWARD_DISTRIBUTION_SERVICE",
    async (d, { dispatch }) => {
      dispatch(LOADING_START());
      const { data, status } = await axios.get(
        "https://rsibackend.rasadyar.com/app/guilds-transport-carcass-dashboard",
        {
          params: d,
        }
      );
      dispatch(LOADING_END());
      return { data, status };
    }
  );
