feat: integrate Convex authentication across ticket management routes

- Added useConvexWithAuth hook to ensure authenticated access for ticket-related pages.
- Updated the perfil and central-chamados routes to include the authentication setup.
- Enhanced user navigation by adding a new "Meus Chamados" tab in the perfil page for better access to ticket management.
This commit is contained in:
2025-11-16 14:19:01 -03:00
parent 118051ad56
commit 24b8eb6a14
4 changed files with 38 additions and 0 deletions

View File

@@ -7,6 +7,7 @@
import TicketTimeline from "$lib/components/chamados/TicketTimeline.svelte";
import { chamadosStore } from "$lib/stores/chamados";
import { resolve } from "$app/paths";
import { useConvexWithAuth } from "$lib/hooks/useConvexWithAuth";
type Ticket = Doc<"tickets">;
type SlaConfig = Doc<"slaConfigs">;
@@ -45,6 +46,11 @@
carregarSlaConfigs();
});
$effect(() => {
// Garante que o cliente Convex use o token do usuário logado
useConvexWithAuth();
});
async function carregarSlaConfigs() {
try {
carregandoSla = true;