import { createRouter, createWebHashHistory } from 'vue-router'
import StartView from "@/views/StartView.vue"
import DrawView from "@/views/DrawView.vue"

// import store from '@/store/index.js'

const routes = [
  {
    path: '/start',
    name: 'StartView',
    component: StartView,
  },
  {
    path: '/draw',
    name: 'DrawView',
    component: DrawView,
  },
]

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

router.beforeEach((to, from) => {
  // 生产环境下强制每次都从首页进入
  if (process.env.NODE_ENV === 'production' && !from.name && to.name !== 'StartView') {
    return '/'
  }
})

export default router
