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 provinceGetAllRequests = createAsyncThunk(
  "PROVINCE_GET_ACTIVE_REQUESTS",
  async (d, { dispatch }) => {
    dispatch(LOADING_START());
    d = d || moment(new Date()).format("YYYY-MM-DD");
    const { data, status } = await axios.get("city_operator_check_request", {
      params: { state: "waiting", date: d },
    });
    dispatch(LOADING_END());
    return { data, status };
  }
);
