import { ref } from 'vue'
import { defineStore } from 'pinia'
import {
  deleteSessionVar,
  getSessionVar,
  saveSessionVar,
} from "@/utils/session";
export const useMenuStore = defineStore('menu', () => {
  let routeList = ref(getSessionVar("routeList") ? JSON.parse(getSessionVar("routeList")) : [])
  //   const routeList = ref([{
  //     path: '/kmplatform/home',
  //     name: 'kmplatform-home',
  //     title: "主页",
  //     children: []
  //   },
  //   {
  //     path: '/kmplatform/knowledgebase',
  //     name: 'knowledgebase',
  //     title: "知识库",
  //     children: []
  //   },
  //   {
  //     path: '/kmplatform/kgbuilder',
  //     name: 'kgbuilder',
  //     title: "知识图谱构建",
  //     children: []
  //   },
  //   {
  //     path: '/kmplatform/openplatform',
  //     name: 'openplatform',
  //     title: "开放平台",
  //     children: []
  //   },
  //   {
  //     path: '/kmplatform/kgpermission',
  //     name: 'kgpermission',
  //     title: "系统权限",
  //     children: []
  //   }
  // ])

  const updateRouteList = (newRoutes) => {
    routeList.value = newRoutes; // 更新路由列表
  };
  return { routeList, updateRouteList }
})
