Initial SuperAdmin web panel (Vue 3)

This commit is contained in:
SuperAdmin
2026-07-23 10:24:50 +03:30
commit 0f94a49b8d
63 changed files with 4762 additions and 0 deletions
+84
View File
@@ -0,0 +1,84 @@
import { createRouter, createWebHistory } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
const router = createRouter({
history: createWebHistory(),
routes: [
{
path: '/login',
name: 'login',
component: () => import('@/pages/LoginPage.vue'),
meta: { public: true },
},
{
path: '/',
component: () => import('@/layouts/AppLayout.vue'),
children: [
{
path: '',
name: 'home',
component: () => import('@/pages/HomePage.vue'),
},
{
path: 'sms',
name: 'sms-panel',
component: () => import('@/pages/SmsPanelPage.vue'),
},
{
path: 'servers',
name: 'server-panel',
component: () => import('@/pages/ServerPanelPage.vue'),
},
{
path: 'products/:product',
name: 'product-versions',
component: () => import('@/pages/ProductVersionsPage.vue'),
},
{
path: 'versions/new',
name: 'version-create',
component: () => import('@/pages/TenantFormPage.vue'),
},
{
path: 'versions/:id',
name: 'version-edit',
component: () => import('@/pages/TenantFormPage.vue'),
},
{
path: 'versions/:id/ui',
name: 'version-ui',
component: () => import('@/pages/UiConfigPage.vue'),
},
{
path: 'audit',
name: 'audit',
component: () => import('@/pages/AuditPage.vue'),
},
// legacy redirects
{ path: 'tenants', redirect: { name: 'home' } },
{ path: 'tenants/new', redirect: { name: 'home' } },
{
path: 'tenants/:id',
redirect: (to) => ({ name: 'version-edit', params: { id: to.params.id } }),
},
],
},
],
})
router.beforeEach(async (to) => {
const auth = useAuthStore()
if (to.meta.public) return true
if (!auth.isAuthenticated) return { name: 'login' }
if (!auth.user) {
try {
await auth.fetchMe()
} catch {
auth.logout()
return { name: 'login' }
}
}
return true
})
export default router