'use strict';

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

const useCountryListStore = pinia.defineStore("gmCountryList", () => {
  const { isLoading, exec } = usePostBasicV1CountryList.usePostBasicV1CountryList();
  const countryList = core.useSessionStorage("gmCountryList", [], { listenToStorageChanges: false });
  const getCountryList = async () => {
    if (countryList.value.length !== 0 || isLoading.value) {
      return;
    }
    return exec().then((response) => {
      if (response.data.value?.code == 200) {
        countryList.value = response.data.value?.data || [];
      }
    });
  };
  core.tryOnMounted(() => {
    getCountryList();
  });
  return {
    countryList,
    isLoading,
    getCountryList
  };
});

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