import { createRouter, createWebHistory } from 'vue-router';
import Login from '../components/Login.vue';
import Register from '../components/Register.vue';
import PostDetail from '@/views/PostDetail.vue';
import MainPage from '@/views/MainPage.vue';
import UserPage from '@/views/UserPage.vue';

const routes = [
  {
    path: '/',
    name: 'MainPage',
    component: MainPage
  },
  {
    path: '/user/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/user/register',
    name: 'Register',
    component: Register
  },
  { 
    path: '/post/:id', 
    name: 'PostDetail', 
    component: PostDetail 
  },
  {
    path: '/user',
    name: 'UserPage',
    component: UserPage
  }
];

const router = createRouter({
  history: createWebHistory(/*process.env.BASE_URL*/),
  routes
});

export default router; 