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

export const cityFetchSamasatTransportChickens = createAsyncThunk(
  "FETCH_SAMASAT_CHICKENS",
  async (d, { dispatch }) => {
    dispatch(LOADING_START());
    const { data, status } = await axios.post(
      "https://pay.rasadyar.net/transporting-chickens/",
      d
    );
    dispatch(LOADING_END());
    return { data, status };
  }
);
export const cityFetchSamasatTransportChickensDetails = createAsyncThunk(
  "FETCH_SAMASAT_CHICKENS_DETAILS",
  async (d, { dispatch }) => {
    dispatch(LOADING_START());
    const { data, status } = await axios.post(
      "https://pay.rasadyar.net/transporting-chickens-details/",
      d
    );
    dispatch(LOADING_END());
    return { data, status };
  }
);

export const visorsGetSamasatCookieService = createAsyncThunk(
  "VISORS_GET_COOKIE",
  async (d, { dispatch }) => {
    dispatch(LOADING_START());
    const { data, status } = await axios.get(`cookie-samasat`);
    dispatch(LOADING_END());
    return { data, status };
  }
);
