- Vue 3.5 + Vite 8 + PrimeVue 4 (Aura) + TailwindCSS 4 + DM Sans - Sistema de tenant multi-prefeitura: bootstrap, prefeituraStore, getTenant - Tema dinâmico por município via applyTemplate (9 paletas) - Logo e foto de fundo resolvidos a partir do VITE_API_URL + path relativo - HomeView: hero split com foto/gradiente, carousel de avisos, cards de serviços - LoginView: fluxo 2 etapas (documento na home → senha em /login) - Roteamento completo: público (/), serviços (/servicos/*), portal autenticado (/portal/*) - authStore + authService estruturados para Keycloak PKCE (integração pendente) - Placeholders para todas as telas da área logada Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
107 lines
3.5 KiB
JavaScript
107 lines
3.5 KiB
JavaScript
import { createRouter, createWebHistory } from 'vue-router'
|
|
import { useAuthStore } from '@/stores/authStore'
|
|
|
|
const router = createRouter({
|
|
history: createWebHistory(import.meta.env.BASE_URL),
|
|
scrollBehavior: () => ({ top: 0 }),
|
|
routes: [
|
|
{
|
|
path: '/',
|
|
component: () => import('@/layouts/PublicLayout.vue'),
|
|
children: [
|
|
{
|
|
path: '',
|
|
name: 'home',
|
|
component: () => import('@/views/public/HomeView.vue'),
|
|
},
|
|
{
|
|
path: 'login',
|
|
name: 'login',
|
|
component: () => import('@/views/public/LoginView.vue'),
|
|
},
|
|
{
|
|
path: 'primeiro-acesso',
|
|
name: 'primeiro-acesso',
|
|
component: () => import('@/views/public/PrimeiroAcessoView.vue'),
|
|
},
|
|
{
|
|
path: 'credenciamento',
|
|
name: 'credenciamento',
|
|
component: () => import('@/views/public/CredenciamentoView.vue'),
|
|
},
|
|
{
|
|
path: 'servicos',
|
|
name: 'servicos',
|
|
component: () => import('@/views/servicos/ServicosHubView.vue'),
|
|
},
|
|
{
|
|
path: 'servicos/certidao',
|
|
name: 'certidao',
|
|
component: () => import('@/views/servicos/CertidaoView.vue'),
|
|
},
|
|
{
|
|
path: 'servicos/iptu',
|
|
name: 'iptu',
|
|
component: () => import('@/views/servicos/IptuView.vue'),
|
|
},
|
|
],
|
|
},
|
|
{
|
|
path: '/portal',
|
|
component: () => import('@/layouts/PortalLayout.vue'),
|
|
meta: { requiresAuth: true },
|
|
children: [
|
|
{
|
|
path: '',
|
|
redirect: { name: 'painel' },
|
|
},
|
|
{
|
|
path: 'painel',
|
|
name: 'painel',
|
|
component: () => import('@/views/portal/PainelView.vue'),
|
|
},
|
|
{
|
|
path: 'debitos',
|
|
name: 'debitos',
|
|
component: () => import('@/views/portal/DebitosView.vue'),
|
|
},
|
|
{
|
|
path: 'certidoes',
|
|
name: 'certidoes-portal',
|
|
component: () => import('@/views/portal/CertidoesView.vue'),
|
|
},
|
|
{
|
|
path: 'alvaras',
|
|
name: 'alvaras',
|
|
component: () => import('@/views/portal/AlvarasView.vue'),
|
|
},
|
|
{
|
|
path: 'pagamentos',
|
|
name: 'pagamentos',
|
|
component: () => import('@/views/portal/PagamentosView.vue'),
|
|
},
|
|
{
|
|
path: 'dados',
|
|
name: 'dados',
|
|
component: () => import('@/views/portal/DadosView.vue'),
|
|
},
|
|
],
|
|
},
|
|
{
|
|
path: '/:pathMatch(.*)*',
|
|
redirect: { name: 'home' },
|
|
},
|
|
],
|
|
})
|
|
|
|
router.beforeEach((to) => {
|
|
if (!to.meta.requiresAuth) return true
|
|
|
|
const auth = useAuthStore()
|
|
if (!auth.isAuthenticated) {
|
|
return { name: 'home' }
|
|
}
|
|
})
|
|
|
|
export default router
|