mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-19 21:18:25 +02:00
5 files changed
+46
-49
No files matched your search
@@ -90,7 +90,7 @@ export default function Layout({ children }: LayoutProps) {
|
|||||||
<Menu className="h-5 w-5" />
|
<Menu className="h-5 w-5" />
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<h1 className="text-lg font-medium text-gray-800">LogiFlow</h1>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Store selector for admin - responsive */}
|
{/* Store selector for admin - responsive */}
|
||||||
|
|||||||
@@ -54,6 +54,20 @@ function RouterProduction() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isAuthenticated) {
|
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 (
|
||||||
|
<div className="min-h-screen w-full flex items-center justify-center bg-surface">
|
||||||
|
<div className="text-center">
|
||||||
|
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"></div>
|
||||||
|
<p className="text-gray-600">Redirection...</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path="/auth" component={AuthPage} />
|
<Route path="/auth" component={AuthPage} />
|
||||||
|
|||||||
@@ -125,7 +125,13 @@ export default function Sidebar() {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const managementItems = [
|
const adminItems = [
|
||||||
|
{
|
||||||
|
path: "/users",
|
||||||
|
label: "Utilisateurs",
|
||||||
|
icon: UserCog,
|
||||||
|
roles: ["admin"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "/suppliers",
|
path: "/suppliers",
|
||||||
label: "Fournisseurs",
|
label: "Fournisseurs",
|
||||||
@@ -138,15 +144,6 @@ export default function Sidebar() {
|
|||||||
icon: Users,
|
icon: Users,
|
||||||
roles: ["admin"]
|
roles: ["admin"]
|
||||||
},
|
},
|
||||||
];
|
|
||||||
|
|
||||||
const adminItems = [
|
|
||||||
{
|
|
||||||
path: "/users",
|
|
||||||
label: "Utilisateurs",
|
|
||||||
icon: UserCog,
|
|
||||||
roles: ["admin"]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "/utilities",
|
path: "/utilities",
|
||||||
label: "Utilitaires",
|
label: "Utilitaires",
|
||||||
@@ -377,44 +374,7 @@ export default function Sidebar() {
|
|||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Management Section */}
|
|
||||||
{managementItems.some(item => hasPermission(item.roles)) && (
|
|
||||||
<>
|
|
||||||
{!sidebarCollapsed && (
|
|
||||||
<div className="mt-6 mb-2">
|
|
||||||
<h3 className="px-3 text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
||||||
Gestion
|
|
||||||
</h3>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{sidebarCollapsed && <div className="mt-4 mb-2 border-t border-gray-200"></div>}
|
|
||||||
<div className="space-y-1">
|
|
||||||
{managementItems.map((item) => {
|
|
||||||
if (!hasPermission(item.roles)) return null;
|
|
||||||
|
|
||||||
const Icon = item.icon;
|
|
||||||
const active = isActive(item.path);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Link key={item.path} href={item.path}>
|
|
||||||
<div
|
|
||||||
className={`flex items-center ${sidebarCollapsed ? 'px-3 py-3 justify-center' : 'px-3 py-2'} text-sm font-medium transition-colors hover:bg-gray-100 ${
|
|
||||||
active
|
|
||||||
? 'bg-gray-100 text-gray-900 border-r-2 border-gray-700'
|
|
||||||
: 'text-gray-700'
|
|
||||||
}`}
|
|
||||||
title={sidebarCollapsed ? item.label : undefined}
|
|
||||||
onClick={() => console.log(`Navigating to management: ${item.path}`)}
|
|
||||||
>
|
|
||||||
<Icon className={`h-4 w-4 ${sidebarCollapsed ? '' : 'mr-3'}`} />
|
|
||||||
{!sidebarCollapsed && item.label}
|
|
||||||
</div>
|
|
||||||
</Link>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
{/* Administration Section */}
|
{/* Administration Section */}
|
||||||
|
|||||||
@@ -54,6 +54,11 @@ export const getQueryFn: <T>(options: {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (unauthorizedBehavior === "returnNull" && res.status === 401) {
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,8 +77,12 @@ export const queryClient = new QueryClient({
|
|||||||
staleTime: 30 * 1000, // 30 secondes de cache pour de meilleures performances
|
staleTime: 30 * 1000, // 30 secondes de cache pour de meilleures performances
|
||||||
gcTime: 10 * 60 * 1000, // 10 minutes
|
gcTime: 10 * 60 * 1000, // 10 minutes
|
||||||
retry: (failureCount, error: any) => {
|
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 (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 false;
|
||||||
}
|
}
|
||||||
return failureCount < 2;
|
return failureCount < 2;
|
||||||
|
|||||||
@@ -19,6 +19,20 @@ La plateforme fournit une gestion robuste des flux de travail de livraison avec
|
|||||||
|
|
||||||
## Recent Changes
|
## 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
|
### 2025-08-13 - Module de sauvegarde PostgreSQL implémenté + correction ESM
|
||||||
✅ **Module de sauvegarde PostgreSQL complet** :
|
✅ **Module de sauvegarde PostgreSQL complet** :
|
||||||
- **Interface BackupManager** : Affichage des sauvegardes avec détails (taille, tables, statut)
|
- **Interface BackupManager** : Affichage des sauvegardes avec détails (taille, tables, statut)
|
||||||
|
|||||||
Reference in new issue
Block a user