This commit is contained in:
xds
2026-02-04 14:43:22 +03:00
commit 4f460b2876
40 changed files with 11425 additions and 0 deletions

53
src/router/index.js Normal file
View File

@@ -0,0 +1,53 @@
import { createRouter, createWebHistory } from 'vue-router'
import DashboardView from '../views/DashboardView.vue'
import LoginView from '../views/LoginView.vue'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/login',
name: 'login',
component: LoginView
},
{
path: '/',
name: 'dashboard',
component: DashboardView
},
{
path: '/assets',
name: 'assets',
component: () => import('../views/AssetsView.vue')
},
{
path: '/characters',
name: 'characters',
component: () => import('../views/CharactersView.vue')
},
{
path: '/characters/:id',
name: 'character-detail',
component: () => import('../views/CharacterDetailView.vue')
},
{
path: '/workspace/:id',
name: 'workspace',
component: () => import('../views/WorkspaceView.vue')
}
]
})
router.beforeEach((to, from, next) => {
const isAuth = localStorage.getItem('auth_code')
if (to.name !== 'login' && !isAuth) {
next({ name: 'login' })
} else if (to.name === 'login' && isAuth) {
next({ name: 'dashboard' })
} else {
next()
}
})
export default router