import { computed } from 'vue';
import { defineStore } from 'pinia';
import '../../../api/productCenter/index.mjs';
import { tryOnMounted } from '@vueuse/core';
import { useGetCompanyCategoryTree } from '../../../api/productCenter/categoryManage/useGetCompanyCategoryTree.mjs';

const useCompanyCategoryListStore = defineStore("gmCompanyCategoryList", () => {
  const { isLoading, exec, data: companyCategoryListData } = useGetCompanyCategoryTree();
  const companyCategoryList = computed(() => companyCategoryListData.value?.data ?? []);
  const getCompanyCategoryList = async () => {
    if (companyCategoryList.value.length !== 0 || isLoading.value) {
      return;
    }
    return exec();
  };
  tryOnMounted(() => {
    getCompanyCategoryList();
  });
  return {
    companyCategoryList,
    isLoading,
    getCompanyCategoryList
  };
});

export { useCompanyCategoryListStore };
//# sourceMappingURL=index.mjs.map
