import {list} from "router/routerData"

export const permissionStore = defineStore('permission', {
    state: () => {
        return {
           permissionList:[],
           routeNavList:[]
        }
    },
    getters: {},
    actions: {
        setpermissionList() {
           return new Promise((resolve,reject)=>{
            setTimeout(()=>{
                console.log("permissionStore")
                resolve(list)
            },0)
           })
        },
        setRouteNavList(list:any) {
            this.routeNavList=list
         }
    },
    persist: {
        enabled: true, // 开启数据缓存
        strategies: [
            {
                // 自定义存储的 key，默认是 store.$id
                key: 'permission',
                storage: sessionStorage, //缓存模式 可选 localStorage sessionStorage
                // state 中的字段名，按组打包储存
                paths: ['permissionList'] //需要缓存的字段 与 state中相关联
            }
        ]
    }
})
