import { ref, computed } from 'vue';
import { defineStore } from 'pinia';
import '../../../api/shopAdmin/index.mjs';
import { tryOnMounted } from '@vueuse/core';
import { getRepiteFillter } from '../../../api/shopAdmin/repite/getRepiteFillter.mjs';

const useRepiteFilterStore = defineStore("gmRepiteFilter", () => {
  const filterData = ref();
  const langList = computed(() => filterData.value?.language.data ?? []);
  const isLoading = ref(false);
  const getRepiteFilterData = async () => {
    if (filterData.value) {
      isLoading.value = false;
      return;
    }
    if (isLoading.value) {
      return;
    }
    try {
      isLoading.value = true;
      const { data } = await getRepiteFillter();
      isLoading.value = false;
      if (data.code !== 0) {
        return;
      }
      filterData.value = data.data;
    } catch (e) {
      console.error(e);
      isLoading.value = false;
    }
  };
  tryOnMounted(() => {
    getRepiteFilterData();
  });
  return {
    filterData,
    langList,
    isLoading,
    getRepiteFilterData
  };
});

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