From 24b8eb6a14430ef4971a0653634238b2c1b7aecf Mon Sep 17 00:00:00 2001 From: deyvisonwanderley Date: Sun, 16 Nov 2025 14:19:01 -0300 Subject: [PATCH] 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. --- .../(dashboard)/abrir-chamado/+page.svelte | 6 +++++ .../routes/(dashboard)/perfil/+page.svelte | 24 +++++++++++++++++++ .../(dashboard)/perfil/chamados/+page.svelte | 5 ++++ .../ti/central-chamados/+page.svelte | 3 +++ 4 files changed, 38 insertions(+) diff --git a/apps/web/src/routes/(dashboard)/abrir-chamado/+page.svelte b/apps/web/src/routes/(dashboard)/abrir-chamado/+page.svelte index c445f2e..7180ddd 100644 --- a/apps/web/src/routes/(dashboard)/abrir-chamado/+page.svelte +++ b/apps/web/src/routes/(dashboard)/abrir-chamado/+page.svelte @@ -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; diff --git a/apps/web/src/routes/(dashboard)/perfil/+page.svelte b/apps/web/src/routes/(dashboard)/perfil/+page.svelte index fa7e589..d23443b 100644 --- a/apps/web/src/routes/(dashboard)/perfil/+page.svelte +++ b/apps/web/src/routes/(dashboard)/perfil/+page.svelte @@ -1,6 +1,7 @@