import { $postParam, $post } from "@/plugins/axios";

// user-manage
export const userListPage = datas => {
  return $postParam("/api/admin/sys/user/list_customer", datas);
};
export const updateUser = datas => {
  return $post("/api/admin/sys/user/save_customer", datas);
};
export const ableUser = ({ id, enable }) => {
  return $post("/api/admin/sys/user/enable", { id, enable });
};
export const resetPwd = id => {
  return $post("/api/admin/sys/user/reset_password", { id });
};
export const userRoleListPage = () => {
  return $postParam("/api/admin/sys/role/list_to_user", {});
};

// menu-manage
export const menuList = datas => {
  return $postParam("/api/admin/sys/privilege/list", datas);
};
export const updateMenu = datas => {
  return $post("/api/admin/sys/privilege/save", datas);
};
export const deleteMenu = id => {
  return $post("/api/admin/sys/privilege/remove", { id });
};

// school-menu-manage
export const schoolMenuTree = () => {
  return $post("/api/admin/menu/custom/list", {});
};
export const schoolSelectedMenuTree = schoolId => {
  return $postParam("/api/admin/menu/custom/get_school_custom_privileges", {
    schoolId
  });
};
export const updateSchoolMenu = datas => {
  return $post("/api/admin/menu/custom/save", datas);
};
// auth-set
// school-menu-manage
export const authSelect = () => {
  return $post("/api/admin/auth/select", {});
};
export const offlineActivation = datas => {
  return $post("/api/admin/auth/offline/activation", datas);
};
export const exportDeviceInfo = () => {
  return $post(
    "/api/admin/auth/export/device/info",
    {},
    {
      responseType: "blob"
    }
  );
};
