import { defineStore } from 'pinia'
import { fetchMenuTree } from '../api/system'

export const useMenuStore = defineStore('menu', {
  state: () => ({
    menuTree: [],
    routesLoaded: false,
  }),
  actions: {
    async fetchMenus() {
      this.menuTree = await fetchMenuTree()
      return this.menuTree
    },
    reset() {
      this.menuTree = []
      this.routesLoaded = false
    },
  },
})

