import { postJ, post, get } from "@/utils/request";
import Vue from "vue";

// 根据父级id查分类树
export async function getTreeByPid(parentId) {
  const data = await get(
    Vue.prototype.apiUrl + `/main/categoryLevel/getTreeByPid/${parentId}`
  );
  if (data.code == 0) {
    return data;
  }
  return Promise.reject(new Error(data.message));
}
// 根据类型查分类树
// export async function getTreeByType (type) {
//   const res = await request.get(`/main/categoryLevel/getTreeByType/${type}`);
//   if (res.data.code == 0) {
//     return res.data;
//   }
//   return Promise.reject(new Error(res.data.message));
// }
