import { http } from "/@/utils/http";
import { loadEnv } from "@build/index";
import { httpExport } from "/@/api/export";

const { VITE_PROXY_DOMAIN_REAL } = loadEnv();
const yewuApi = VITE_PROXY_DOMAIN_REAL + "/";

export function createHttpRequest(path: string) {
  return (data: object): Promise<any> => {
    return http.request("post", `${yewuApi}${path}`, {
      data
    });
  };
}

export function createExportRequest(path: string) {
  return (data: object): Promise<any> =>
    httpExport(path, {
      data
    });
}
