import { defineStore } from 'pinia'
import { generateRouter, setAddRoute } from '@/router/vue-router.js'
export const routeStore = defineStore('route', {
    state: () => {
        return {
        }
    },
    actions: {
        addRouter() {
            // 生成路由树
            // routerList在登陆成功时获取到，在跳转页面之前存起来
            let find = JSON.parse(window.localStorage.getItem('routerList'))
            let routerList = generateRouter(find)
            // 添加路由
            setAddRoute(routerList)
        },
    },
    getters: {},
})