Initial commit

This commit is contained in:
2026-10-26 12:28:48 +09:00
commit 18f10cece4
269 changed files with 33654 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
import { useAuthStore } from '@/stores/auth.store'
// 코드 스플리팅 — 모든 페이지 컴포넌트는 lazy import 처리
const routes: RouteRecordRaw[] = [
{
path: '/',
name: 'home',
component: () => import('@/pages/HomePage.vue'),
meta: { requiresAuth: false },
},
{
path: '/:pathMatch(.*)*',
name: 'not-found',
component: () => import('@/pages/NotFoundPage.vue'),
},
]
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes,
})
// 네비게이션 가드 — 보호 라우트(requiresAuth) 접근 시 인증 여부 검사
router.beforeEach((to) => {
const authStore = useAuthStore()
if (to.meta.requiresAuth && !authStore.isLoggedIn) {
// 미인증 시 홈으로 리다이렉트
// (실제 로그인 페이지 추가 시 { name: 'login' } 으로 변경)
return { name: 'home' }
}
return true
})
export default router