 
import { createRouter, createWebHistory} from 'vue-router'
import { systemRoutes } from './system'
import { imRoutes } from './im'
import { whitelistRoutes } from './whitelist'
import { createRouterGuards } from './router.guards.js'



let routes = []

console.log("import.meta.env.VITE_DAPP_BUILD=", import.meta.env.VITE_DAPP_BUILD);

if (import.meta.env.VITE_DAPP_BUILD == "1") {
  routes = [
    ...systemRoutes,
    ...whitelistRoutes
  ]
}

if (import.meta.env.VITE_DAPP_BUILD == "2") {
  routes = [
    ...imRoutes
  ]
}



const router = createRouter({
  history: createWebHistory(),
  routes: routes,
})


export async function setupRouter(app) { 
  app.use(router)
  // 创建路由守卫
  createRouterGuards(router)
}

export default router;