'use strict';

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

const useRoleListStore = pinia.defineStore("gmRoleList", () => {
  const { isLoading, exec } = usePostBasicV1RoleList.usePostBasicV1RoleList();
  const roleList = core.useSessionStorage("gmRoleList", [], { listenToStorageChanges: false });
  const getRoleList = async () => {
    if (roleList.value.length !== 0 || isLoading.value) {
      return;
    }
    return exec().then((res) => {
      if (res.data.value?.code == 200) {
        roleList.value = res.data.value?.data || [];
      }
    });
  };
  core.tryOnMounted(() => {
    getRoleList();
  });
  return {
    roleList,
    isLoading,
    getRoleList
  };
});

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