'use strict';

var vue = require('vue');
var pinia = require('pinia');
require('../../../api/shopAdmin/index.js');
var core = require('@vueuse/core');
var getRepiteFillter = require('../../../api/shopAdmin/repite/getRepiteFillter.js');

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

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