import { createRouter, createWebHistory } from 'vue-router';
import appRoutes from './routes';

const router = createRouter({
  history: createWebHistory(),
  routes: appRoutes,
  scrollBehavior: (to: any, _from: any, savedPosition: any) => {
    if (savedPosition) {
      return savedPosition;
    }
    return to.hash ? { behavior: 'smooth', el: to.hash } : { left: 0, top: 0 };
  },
});

export default router;
