forked from baron/baron-sso
fix(adminfront): allow tenant admin to view list when managing multiple tenants and fix dev profile fetching
This commit is contained in:
@@ -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(() => {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user