import {  createRouter,createWebHistory } from "vue-router";

import { beforeEachRoute } from '@/services/nav'

// Routes
import RetailorRoutes from './retailer.routes'
import GateRoutes from './gate.routes'


export const routes = [
 ...GateRoutes,
 ...RetailorRoutes,
]


const router = createRouter({
  history: createWebHistory(),
   base: import.meta.env.BASE_URL || '/',
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) return savedPosition

    return { x: 0, y: 0 }
  },
  routes,
});


router.beforeEach(beforeEachRoute);

export default router