import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

import { constantRoutes as route1s } from "@base/router/modules/system";
import { constantRoutes as route2s } from "@/router/modules/customer";

export const constantRoutes = [...route1s, ...route2s];

const createRouter = () =>
  new Router({
    // mode: 'history', // require service support
    scrollBehavior: () => ({
      y: 0,
    }),
    routes: constantRoutes,
  });

const router = createRouter();

export function resetRouter() {
  const newRouter = createRouter();
  router.matcher = newRouter.matcher; // reset router
}

export default router;
