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

export const slaughterNewRequest = createAsyncThunk(
  "SLAUGHTER_NEW_REQUEST",
  async (d, { dispatch }) => {
    try {
      const { data, status } = await axios.post("kill_request/", d);
      return { data, status };
    } catch (e) {
      dispatch(LOADING_END());
      return { error: e.response.data.result };
    }
  }
);
