diff --git a/client/src/components/Layout.tsx b/client/src/components/Layout.tsx index 5713485..acdbd3e 100644 --- a/client/src/components/Layout.tsx +++ b/client/src/components/Layout.tsx @@ -90,7 +90,7 @@ export default function Layout({ children }: LayoutProps) { )} -

LogiFlow

+ {/* Store selector for admin - responsive */} diff --git a/client/src/components/RouterProduction.tsx b/client/src/components/RouterProduction.tsx index 53f7a54..6a7506f 100644 --- a/client/src/components/RouterProduction.tsx +++ b/client/src/components/RouterProduction.tsx @@ -54,6 +54,20 @@ function RouterProduction() { } if (!isAuthenticated) { + // Redirection automatique vers la page d'authentification + if (typeof window !== 'undefined' && window.location.pathname !== '/auth') { + console.log('🔄 User not authenticated, redirecting to auth page'); + window.location.href = '/auth'; + return ( +
+
+
+

Redirection...

+
+
+ ); + } + return ( diff --git a/client/src/components/Sidebar.tsx b/client/src/components/Sidebar.tsx index 516881e..99069b6 100644 --- a/client/src/components/Sidebar.tsx +++ b/client/src/components/Sidebar.tsx @@ -125,7 +125,13 @@ export default function Sidebar() { }, ]; - const managementItems = [ + const adminItems = [ + { + path: "/users", + label: "Utilisateurs", + icon: UserCog, + roles: ["admin"] + }, { path: "/suppliers", label: "Fournisseurs", @@ -138,15 +144,6 @@ export default function Sidebar() { icon: Users, roles: ["admin"] }, - ]; - - const adminItems = [ - { - path: "/users", - label: "Utilisateurs", - icon: UserCog, - roles: ["admin"] - }, { path: "/utilities", label: "Utilitaires", @@ -377,44 +374,7 @@ export default function Sidebar() { })} - {/* Management Section */} - {managementItems.some(item => hasPermission(item.roles)) && ( - <> - {!sidebarCollapsed && ( -
-

- Gestion -

-
- )} - {sidebarCollapsed &&
} -
- {managementItems.map((item) => { - if (!hasPermission(item.roles)) return null; - - const Icon = item.icon; - const active = isActive(item.path); - - return ( - -
console.log(`Navigating to management: ${item.path}`)} - > - - {!sidebarCollapsed && item.label} -
- - ); - })} -
- - )} + {/* Administration Section */} diff --git a/client/src/lib/queryClient.ts b/client/src/lib/queryClient.ts index fa5743f..8befad5 100644 --- a/client/src/lib/queryClient.ts +++ b/client/src/lib/queryClient.ts @@ -54,6 +54,11 @@ export const getQueryFn: (options: { }); if (unauthorizedBehavior === "returnNull" && res.status === 401) { + // Redirection automatique vers la page d'authentification si 401 + if (typeof window !== 'undefined' && window.location.pathname !== '/auth') { + console.log('🔄 API 401 - Redirecting to auth page'); + window.location.href = '/auth'; + } return null; } @@ -72,8 +77,12 @@ export const queryClient = new QueryClient({ staleTime: 30 * 1000, // 30 secondes de cache pour de meilleures performances gcTime: 10 * 60 * 1000, // 10 minutes retry: (failureCount, error: any) => { - // Ne pas retry les erreurs d'authentification + // Ne pas retry les erreurs d'authentification et rediriger if (error?.message?.includes('401') || error?.message?.includes('Unauthorized')) { + if (typeof window !== 'undefined' && window.location.pathname !== '/auth') { + console.log('🔄 Query 401 - Redirecting to auth page'); + window.location.href = '/auth'; + } return false; } return failureCount < 2; diff --git a/replit.md b/replit.md index 3f717b6..2ca26ef 100644 --- a/replit.md +++ b/replit.md @@ -19,6 +19,20 @@ La plateforme fournit une gestion robuste des flux de travail de livraison avec ## Recent Changes +### 2025-08-13 - Interface épurée + redirection automatique + réorganisation navigation +✅ **Redirection automatique vers authentification** : +- RouterProduction redirige immédiatement si utilisateur non connecté +- Query client gère les erreurs 401 avec redirection automatique +- Gestion centralisée des sessions expirées pour meilleure UX +- Plus de pages d'erreur, redirection transparente vers /auth + +✅ **Interface épurée et navigation optimisée** : +- Titre LogiFlow supprimé du header principal (évite redondance) +- Seul titre dans la sidebar conservé pour navigation centralisée +- Fournisseurs et Magasins déplacés dans Administration +- Catégorie "Gestion" supprimée (consolidation menu) +- Interface plus propre et logique + ### 2025-08-13 - Module de sauvegarde PostgreSQL implémenté + correction ESM ✅ **Module de sauvegarde PostgreSQL complet** : - **Interface BackupManager** : Affichage des sauvegardes avec détails (taille, tables, statut)