import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import LoginView from  '../views/LoginView'
import RegisterView from '../views/RegisterView'
import NotFoundView from '../views/NotFoundView'
import UserProfileView from '../views/UserProfileView'
import CkeditorView from '../views/CkeditorView'

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
  },
  {
    path: '/login/',
    name: 'login',
    component: LoginView,
  },
  {
    path: '/register/',
    name: 'register',
    component: RegisterView,
  },
  {
    path: '/userprofile/',
    name:'userprofile',
    component:UserProfileView,
  },
  {
    path: '/404/',
    name: '404',
    component: NotFoundView
  },
  {
    path: '/ckeditor/',
    name: 'ckeditor',
    component: CkeditorView,
  },
  {
    path: '/:catchAll(.*)',
    redirect: '/404/',
  },
  {
    path: '/web_api/',
    target:'http://localhost:14514/',
    changeOrigin:true,   //修改源
    rewrite:{'^/web_api/':''}
  }
]

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

export default router
