'use strict';

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

const useCurrencyListStore = pinia.defineStore("gmCurrencyList", () => {
  const { isLoading, exec } = usePostBasicV1CurrencyListAll.usePostBasicV1CurrencyListAll();
  const currencyList = core.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 || [];
      }
    });
  };
  core.tryOnMounted(() => {
    getCurrencyList();
  });
  return {
    currencyList,
    isLoading,
    getCurrencyList
  };
});

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