import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../pages/Home.vue'
import BigMap from '@/views/gui/BigMap.vue'
import CustomHotspotList from '@/views/gui/CustomHotspotList.vue'

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    children: [
      {
        path: 'big-map',
        name: 'BigMap',
        component: BigMap,
      },
      {
        path: 'hotspot-list',
        name: 'HotspotList',
        component: CustomHotspotList,
      },
    ],
  }
]

const router = new VueRouter({
  routes
})

export default router
