From b6c7a9dc4353314dd5ee4c2b093fb82d65cb4319 Mon Sep 17 00:00:00 2001 From: chan Date: Wed, 4 Mar 2026 14:44:45 +0900 Subject: [PATCH] fix(adminfront): allow tenant admin to view list when managing multiple tenants and fix dev profile fetching --- adminfront/src/components/layout/AppLayout.tsx | 4 +++- adminfront/src/features/tenants/routes/TenantListPage.tsx | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/adminfront/src/components/layout/AppLayout.tsx b/adminfront/src/components/layout/AppLayout.tsx index e8f25a24..f28178d8 100644 --- a/adminfront/src/components/layout/AppLayout.tsx +++ b/adminfront/src/components/layout/AppLayout.tsx @@ -43,7 +43,9 @@ function AppLayout() { const { data: profile } = useQuery({ queryKey: ["me"], queryFn: fetchMe, - enabled: auth.isAuthenticated && !auth.isLoading, + enabled: + (auth.isAuthenticated && !auth.isLoading) || + import.meta.env.MODE === "development", }); const navItems = React.useMemo(() => { diff --git a/adminfront/src/features/tenants/routes/TenantListPage.tsx b/adminfront/src/features/tenants/routes/TenantListPage.tsx index 669181c1..44a1aa18 100644 --- a/adminfront/src/features/tenants/routes/TenantListPage.tsx +++ b/adminfront/src/features/tenants/routes/TenantListPage.tsx @@ -69,8 +69,8 @@ function TenantListPage() { ); } - // While redirecting - if (profile?.role === "tenant_admin") { + // While redirecting (only if exactly one manageable tenant) + if (profile?.role === "tenant_admin" && (profile.manageableTenants?.length ?? 0) <= 1) { return null; }