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

const { VITE_PROXY_DOMAIN_REAL } = loadEnv();

// 添加
export async function httpAdd(data: object = {}): Promise<DataType<any>> {
  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/adminAdd`, {
    data
  });
}
// 列表
export async function httpList(data: object = {}): Promise<DataType<any>> {
  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/adminList`, {
    data
  });
}
// 详情
export async function httpDetail(data: object = {}): Promise<DataType<any>> {
  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/adminRead`, {
    data
  });
}
// 更新
export async function httpUpdate(data: object = {}): Promise<DataType<any>> {
  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/adminEdit`, {
    data
  });
}
// 状态
export async function httpStatus(data: object = {}): Promise<DataType<any>> {
  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/adminStatus`, {
    data
  });
}
// 删除
export async function httpDelete(data: object = {}): Promise<DataType<any>> {
  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/adminDelete`, {
    data
  });
}
// 修改密码
export async function httpChangePwd(data: object = {}): Promise<DataType<any>> {
  return http.request(
    "post",
    `${VITE_PROXY_DOMAIN_REAL}admin/adminChangePasswod`,
    {
      data
    }
  );
}
// 全部角色
export async function httpRoleAll(data: object = {}): Promise<DataType<any>> {
  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/roleall`, {
    data
  });
}
// 设置角色
export async function httpCardAll(data: object = {}): Promise<DataType<any>> {
  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/cardAll`, {
    data
  });
}
