import { ref } from 'vue';
import { defineStore } from 'pinia';
import { useSessionStorage, tryOnMounted } from '@vueuse/core';
import { useLoading } from '../../../base/useLoading/index.mjs';
import '../../../../api/guardBasic/controller/index.mjs';
import { postBasicV1LanguageListAll } from '../../../../api/guardBasic/controller/JiChuFuWu/YuZhongGuanLi/postBasicV1LanguageListAll.mjs';

const useLangListStore = defineStore("gmLangList", () => {
  const langList = useSessionStorage("gmLangList", [], { listenToStorageChanges: false });
  const { isLoading, exec: getLangListExec, getDataFinally } = useLoading(postBasicV1LanguageListAll);
  const isFinished = ref(false);
  const getLangList = async () => {
    if (langList.value.length !== 0 || isLoading.value) {
      return;
    }
    const { data } = await getLangListExec();
    if (data.code !== 200) {
      return;
    }
    langList.value = data.data.map((item) => item.id === 10 ? { ...item, name: "\u5370\u5C3C\u8BED" } : item);
  };
  tryOnMounted(() => {
    getLangList();
  });
  return {
    langList,
    isLoading,
    isFinished,
    getLangList,
    getDataFinally
  };
});

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