diff --git a/frontend/src/api/hooks/forecasting.ts b/frontend/src/api/hooks/forecasting.ts index 026fc6e2..a7b79e29 100644 --- a/frontend/src/api/hooks/forecasting.ts +++ b/frontend/src/api/hooks/forecasting.ts @@ -116,7 +116,7 @@ export const useForecastingHealth = ( export const useInfiniteTenantForecasts = ( tenantId: string, baseParams?: Omit, - options?: Omit, 'queryKey' | 'queryFn' | 'getNextPageParam' | 'initialPageParam'> + options?: Omit, 'queryKey' | 'queryFn' | 'getNextPageParam' | 'initialPageParam' | 'select'> ) => { const limit = 20; diff --git a/frontend/src/pages/public/AboutPage.tsx b/frontend/src/pages/public/AboutPage.tsx index 9fdfdceb..67b8688a 100644 --- a/frontend/src/pages/public/AboutPage.tsx +++ b/frontend/src/pages/public/AboutPage.tsx @@ -91,7 +91,7 @@ const AboutPage: React.FC = () => { return ( { return ( { return ( { return ( { return ( { return ( { + diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index e6013cd2..7ff50e2d 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -1,15 +1,11 @@ export { AppRouter, default as Router } from './AppRouter'; export { ProtectedRoute } from './ProtectedRoute'; -export { - ROUTES, - ROUTE_CONFIGS, - canAccessRoute, - getRouteByPath, - getRoutesForRole, - getRoutesWithPermission, - isPublicRoute, - isProtectedRoute, - type RouteConfig +export { + ROUTES, + routesConfig, + canAccessRoute, + getRouteByPath, + type RouteConfig } from './routes.config'; // Additional utility exports for route components diff --git a/frontend/src/router/routes.config.ts b/frontend/src/router/routes.config.ts index f85b2089..4b723d41 100644 --- a/frontend/src/router/routes.config.ts +++ b/frontend/src/router/routes.config.ts @@ -12,8 +12,8 @@ export interface RouteConfig { description?: string; icon?: string; requiresAuth: boolean; - requiredRoles?: string[]; - requiredPermissions?: string[]; + requiredRoles?: readonly string[]; + requiredPermissions?: readonly string[]; requiredSubscriptionFeature?: string; requiredAnalyticsLevel?: 'basic' | 'advanced' | 'predictive'; showInNavigation?: boolean; diff --git a/frontend/src/stores/auth.store.ts b/frontend/src/stores/auth.store.ts index 139fb8b1..532ff260 100644 --- a/frontend/src/stores/auth.store.ts +++ b/frontend/src/stores/auth.store.ts @@ -14,7 +14,7 @@ export interface User { language?: string; timezone?: string; avatar?: string; // User avatar image URL - tenant_id?: string; + tenant_id?: string | null; role?: GlobalUserRole; } diff --git a/frontend/src/stores/index.ts b/frontend/src/stores/index.ts index 744993ef..a6e4c7b2 100644 --- a/frontend/src/stores/index.ts +++ b/frontend/src/stores/index.ts @@ -2,7 +2,7 @@ export { useAuthStore, useAuthUser, useIsAuthenticated, useAuthLoading, useAuthError, usePermissions, useAuthActions } from './auth.store'; export type { User, AuthState } from './auth.store'; -export { useUIStore, useLanguage, useSidebar, useCompactMode, useViewMode, useLoading, useToasts, useModals, useBreadcrumbs, usePreferences, useUIActions } from './ui.store'; +export { useUIStore, useLanguage, useSidebar, useCompactMode, useViewMode, useLoading, useModals, useBreadcrumbs, usePreferences, useUIActions } from './ui.store'; export type { Theme, Language, ViewMode, SidebarState, Toast, Modal, UIState } from './ui.store'; diff --git a/frontend/src/utils/permissions.ts b/frontend/src/utils/permissions.ts index 400cb0ff..c5397c4f 100644 --- a/frontend/src/utils/permissions.ts +++ b/frontend/src/utils/permissions.ts @@ -210,19 +210,19 @@ export function checkCombinedPermission( } = options; // Check global roles - const hasGlobalAccess = globalRoles.length === 0 || ( + const hasGlobalAccess = globalRoles.length === 0 || Boolean( user?.is_active && globalRoles.some(role => hasGlobalRole(user.role, role)) ); // Check tenant roles - const hasTenantRoleAccess = tenantRoles.length === 0 || ( + const hasTenantRoleAccess = tenantRoles.length === 0 || Boolean( tenantAccess?.has_access && tenantRoles.some(role => hasTenantRole(tenantAccess.role, role)) ); // Check tenant permissions - const hasTenantPermissionAccess = tenantPermissions.length === 0 || ( + const hasTenantPermissionAccess = tenantPermissions.length === 0 || Boolean( tenantAccess?.has_access && tenantPermissions.some(perm => tenantAccess.permissions?.includes(perm)) );