LOOP-RUN-002 sample: admin order multi-filter, membership display price catalog, read-only refund_status. No real payment or RBAC. Co-authored-by: Cursor <cursoragent@cursor.com>
32 lines
1.4 KiB
TypeScript
32 lines
1.4 KiB
TypeScript
import { createRouter, createWebHistory } from 'vue-router'
|
|
import { getToken } from '@/api/client'
|
|
|
|
const router = createRouter({
|
|
history: createWebHistory(import.meta.env.BASE_URL),
|
|
routes: [
|
|
{ path: '/login', name: 'login', component: () => import('@/pages/LoginPage.vue'), meta: { public: true } },
|
|
{
|
|
path: '/',
|
|
component: () => import('@/layouts/AdminShell.vue'),
|
|
children: [
|
|
{ path: '', name: 'dashboard', component: () => import('@/pages/DashboardPage.vue') },
|
|
{ path: 'analytics', name: 'analytics', component: () => import('@/pages/AnalyticsPage.vue') },
|
|
{ path: 'content', name: 'content', component: () => import('@/pages/ContentPage.vue') },
|
|
{ path: 'users', name: 'users', component: () => import('@/pages/UsersPage.vue') },
|
|
{ path: 'users/:id', name: 'user', component: () => import('@/pages/UserDetailPage.vue') },
|
|
{ path: 'orders', name: 'orders', component: () => import('@/pages/OrdersPage.vue') },
|
|
{ path: 'pricing', name: 'pricing', component: () => import('@/pages/PricingPage.vue') },
|
|
{ path: 'audit', name: 'audit', component: () => import('@/pages/AuditPage.vue') },
|
|
],
|
|
},
|
|
],
|
|
})
|
|
|
|
router.beforeEach((to) => {
|
|
if (to.meta.public) return true
|
|
if (!getToken()) return { name: 'login', query: { redirect: to.fullPath } }
|
|
return true
|
|
})
|
|
|
|
export default router
|