'use strict';

var pinia = require('pinia');
var core = require('@vueuse/core');
require('../../../../api/guardBasic/controller/index.js');
var usePostBasicV1OrgFamilyList = require('../../../../api/guardBasic/controller/JiChuFuWu/ZuZhiGuanLi/usePostBasicV1OrgFamilyList.js');

const useOrgListStore = pinia.defineStore("gmOrgList", () => {
  const { isLoading, exec } = usePostBasicV1OrgFamilyList.usePostBasicV1OrgFamilyList();
  const orgList = core.useSessionStorage("gmOrgList", [], { listenToStorageChanges: false });
  const getOrgList = async () => {
    if (orgList.value.length !== 0 || isLoading.value) {
      return;
    }
    return exec().then((res) => {
      if (res.data.value?.code == 200) {
        orgList.value = res.data.value?.data || [];
      }
    });
  };
  core.tryOnMounted(() => {
    getOrgList();
  });
  return {
    orgList,
    isLoading,
    getOrgList
  };
});

exports.useOrgListStore = useOrgListStore;
//# sourceMappingURL=index.js.map
