feat: Pulse CRM Frontend v1.0
Vue 3 + Vite + Tailwind CSS Views: - Dashboard mit Stats & Aktivitäten - Kontakte mit Suche & CRUD - Firmen mit Cards & CRUD - Pipeline Kanban Board (Drag & Drop) - Aktivitäten mit Filter & Timeline - Settings mit DSGVO-Info Features: - Dark Theme (Pulse Design) - Responsive Layout - Pinia State Management - Vue Router mit Guards - Axios API Client Task: #13 Frontend UI
This commit is contained in:
86
src/router/index.js
Normal file
86
src/router/index.js
Normal file
@@ -0,0 +1,86 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/login',
|
||||
name: 'Login',
|
||||
component: () => import('@/views/LoginView.vue'),
|
||||
meta: { guest: true }
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
component: () => import('@/layouts/AppLayout.vue'),
|
||||
meta: { requiresAuth: true },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'Dashboard',
|
||||
component: () => import('@/views/DashboardView.vue')
|
||||
},
|
||||
{
|
||||
path: 'contacts',
|
||||
name: 'Contacts',
|
||||
component: () => import('@/views/ContactsView.vue')
|
||||
},
|
||||
{
|
||||
path: 'contacts/:id',
|
||||
name: 'ContactDetail',
|
||||
component: () => import('@/views/ContactDetailView.vue')
|
||||
},
|
||||
{
|
||||
path: 'companies',
|
||||
name: 'Companies',
|
||||
component: () => import('@/views/CompaniesView.vue')
|
||||
},
|
||||
{
|
||||
path: 'companies/:id',
|
||||
name: 'CompanyDetail',
|
||||
component: () => import('@/views/CompanyDetailView.vue')
|
||||
},
|
||||
{
|
||||
path: 'pipeline',
|
||||
name: 'Pipeline',
|
||||
component: () => import('@/views/PipelineView.vue')
|
||||
},
|
||||
{
|
||||
path: 'deals/:id',
|
||||
name: 'DealDetail',
|
||||
component: () => import('@/views/DealDetailView.vue')
|
||||
},
|
||||
{
|
||||
path: 'activities',
|
||||
name: 'Activities',
|
||||
component: () => import('@/views/ActivitiesView.vue')
|
||||
},
|
||||
{
|
||||
path: 'settings',
|
||||
name: 'Settings',
|
||||
component: () => import('@/views/SettingsView.vue')
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/:pathMatch(.*)*',
|
||||
redirect: '/'
|
||||
}
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes
|
||||
})
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
const auth = useAuthStore()
|
||||
|
||||
if (to.meta.requiresAuth && !auth.isAuthenticated) {
|
||||
next('/login')
|
||||
} else if (to.meta.guest && auth.isAuthenticated) {
|
||||
next('/')
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
})
|
||||
|
||||
export default router
|
||||
Reference in New Issue
Block a user