import { defineStore } from 'pinia';
import { useSessionStorage, tryOnMounted } from '@vueuse/core';
import '../../../../api/guardBasic/controller/index.mjs';
import { usePostBasicV1CurrencyListAll } from '../../../../api/guardBasic/controller/JiChuFuWu/BiZhongGuanLi/usePostBasicV1CurrencyListAll.mjs';

const useCurrencyListStore = defineStore("gmCurrencyList", () => {
  const { isLoading, exec } = usePostBasicV1CurrencyListAll();
  const currencyList = useSessionStorage("gmCurrencyList", [], { listenToStorageChanges: false });
  const getCurrencyList = async () => {
    if (currencyList.value.length !== 0 || isLoading.value) {
      return;
    }
    return exec().then((res) => {
      if (res.data.value?.code == 200) {
        currencyList.value = res.data.value?.data || [];
      }
    });
  };
  tryOnMounted(() => {
    getCurrencyList();
  });
  return {
    currencyList,
    isLoading,
    getCurrencyList
  };
});

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