import { http } from "/@/utils/http";
import { loadEnv } from "@build/index";
const { VITE_PROXY_DOMAIN_REAL, VITE_PROXY_USER_REAL } = loadEnv();
const userAPi = VITE_PROXY_DOMAIN_REAL;
const yewuApi = VITE_PROXY_USER_REAL + "/admin/";
interface ResponseType extends Promise<any> {
  data?: object;
  code?: number;
  message?: string;
}

// 获取所有菜单
export const httpMenuList = (): ResponseType => {
  return http.request("post", `${yewuApi}menulist`, {
    data: {}
  });
};

// 获取用户列表
export const httpUserList = (): ResponseType => {
  return http.request("post", `${yewuApi}userall`, { data: {} });
};

//用户组列表
export const httpUserGroup = (data = {}): ResponseType => {
  return http.request("post", `${yewuApi}getDataGroupList`, { data });
};

//数据共享列表
export const httpList = (data = {}): ResponseType => {
  return http.request("post", `${yewuApi}getDataShareList`, { data });
};

//新建数据共享
export const httpAdd = (data = {}): ResponseType => {
  return http.request("post", `${yewuApi}addDataShare`, { data });
};

//数据共享详情
export const httpDetail = (data = {}): ResponseType => {
  return http.request("post", `${yewuApi}getDataShareDetail`, { data });
};

//数据共享编辑
export const httpUpdate = (data = {}): ResponseType => {
  return http.request("post", `${yewuApi}editDataShare`, { data });
};

//数据共享编辑
export const httpStatus = (data = {}): ResponseType => {
  return http.request("post", `${yewuApi}statusDataShare`, { data });
};
