From d5643ec0e94b8a99962603d3fc75459bf1592077 Mon Sep 17 00:00:00 2001 From: hreyes Date: Wed, 3 Jun 2026 14:10:17 +0000 Subject: [PATCH] fix/permisos-custom-broker (#486) permisos marcaba error de permisos aunque si los tuviera, solo era visual y mal consulta de roles Reviewed-on: https://git.aduanasoft.com/ADUANASOFT/anexo76/pulls/486 Co-authored-by: hreyes Co-committed-by: hreyes --- .../routes/dashboard/customs_brokers/+page.svelte | 13 ++++++++++--- .../reference_data/customs_sections/+page.svelte | 11 ++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/frontend/src/routes/dashboard/customs_brokers/+page.svelte b/frontend/src/routes/dashboard/customs_brokers/+page.svelte index b926ce5f..a6f35421 100644 --- a/frontend/src/routes/dashboard/customs_brokers/+page.svelte +++ b/frontend/src/routes/dashboard/customs_brokers/+page.svelte @@ -5,7 +5,7 @@ import { Button } from '$lib/components/ui/button'; import { Input } from '$lib/components/ui/input'; import { Label } from '$lib/components/ui/label'; - import { Plus, RefreshCw, Building2, MapPin, Mail, Phone, FileText, Hash } from 'lucide-svelte'; + import { Plus, RefreshCw, Building2, MapPin, Mail, Phone, FileText, Hash, LoaderCircle } from 'lucide-svelte'; import * as Tabs from '$lib/components/ui/tabs'; import { toast } from 'svelte-sonner'; import { companyStore } from '$lib/stores/company.svelte'; @@ -14,7 +14,7 @@ import { page } from '$app/stores'; import { useShortcuts } from '$lib/hooks/use-shortcuts'; import { obtenerAtajosListaAgentes } from '$lib/config/shortcuts/dashboard/customs_brokers/list'; - import { currentUser } from '$lib/auth'; + import { currentUser, permissionsHydrated } from '$lib/auth'; import { canViewCustomsBrokers, canCreateCustomsBrokers, @@ -236,7 +236,14 @@ const brokerColumns = createBrokerColumns(handleActionSuccess); -{#if !canViewBrokerList} +{#if !$permissionsHydrated} +
+ +

Verificando permisos…

+
+{:else if !canViewBrokerList}
diff --git a/frontend/src/routes/dashboard/reference_data/customs_sections/+page.svelte b/frontend/src/routes/dashboard/reference_data/customs_sections/+page.svelte index 4fa5d730..2023dc02 100644 --- a/frontend/src/routes/dashboard/reference_data/customs_sections/+page.svelte +++ b/frontend/src/routes/dashboard/reference_data/customs_sections/+page.svelte @@ -12,10 +12,10 @@ import { Input } from '$lib/components/ui/input'; import { page } from '$app/stores'; import { browser } from '$app/environment'; - import { RefreshCw, Plus } from 'lucide-svelte'; + import { RefreshCw, Plus, LoaderCircle } from 'lucide-svelte'; import { useShortcuts } from '$lib/hooks/use-shortcuts'; import type { PageData } from './$types'; - import { currentUser } from '$lib/auth'; + import { currentUser, permissionsHydrated } from '$lib/auth'; import { userHasCustomsSectionsRefAction } from '$lib/permissions/reference-data/customs-sections-ref-permissions'; import ErrorState from '$lib/components/dashboard/common/error-state.svelte'; @@ -124,7 +124,12 @@
- {#if !canView || isError} + {#if !$permissionsHydrated} +
+ +

Verificando permisos…

+
+ {:else if !canView || isError}