mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-18 12:47:33 +02:00
Refine debug logging for development and production environments
Update console logs to only display in development mode and improve error handling logic for production authentication and reconciliation processes. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 1e4433b5-47ab-464c-b663-fea2e53367dd Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/1e4433b5-47ab-464c-b663-fea2e53367dd/zhCtuJP
This commit is contained in:
1 parent
b51f1ace40
commit
2a23e0da4d
5 files changed
+136
-64
No files matched your search
@@ -95,7 +95,9 @@ export default function AuthPage() {
|
||||
return response;
|
||||
},
|
||||
onSuccess: async (loginResult) => {
|
||||
console.log('✅ Login successful, refreshing auth state...');
|
||||
if (import.meta.env.DEV) {
|
||||
console.log('✅ Login successful, refreshing auth state...');
|
||||
}
|
||||
|
||||
toast({
|
||||
title: "Connexion réussie",
|
||||
@@ -108,10 +110,14 @@ export default function AuthPage() {
|
||||
|
||||
// Force immediate authentication state refresh
|
||||
const refreshedUserData = await forceAuthRefresh();
|
||||
console.log('🔄 Force auth refresh result:', refreshedUserData);
|
||||
if (import.meta.env.DEV) {
|
||||
console.log('🔄 Force auth refresh result:', refreshedUserData);
|
||||
}
|
||||
|
||||
if (refreshedUserData && refreshedUserData.id) {
|
||||
console.log('🔄 User data confirmed, forcing redirect...');
|
||||
if (import.meta.env.DEV) {
|
||||
console.log('🔄 User data confirmed, forcing redirect...');
|
||||
}
|
||||
setLocation("/");
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
@@ -133,12 +139,14 @@ export default function AuthPage() {
|
||||
});
|
||||
|
||||
// Debug logging for authentication state
|
||||
console.log('🔍 AuthPage Debug:', {
|
||||
isAuthenticated,
|
||||
isLoading,
|
||||
userId: user?.id,
|
||||
username: user?.username
|
||||
});
|
||||
if (import.meta.env.DEV) {
|
||||
console.log('🔍 AuthPage Debug:', {
|
||||
isAuthenticated,
|
||||
isLoading,
|
||||
userId: user?.id,
|
||||
username: user?.username
|
||||
});
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (defaultCredentialsCheck) {
|
||||
@@ -149,7 +157,9 @@ export default function AuthPage() {
|
||||
// Redirect if already authenticated
|
||||
useEffect(() => {
|
||||
if (!isLoading && isAuthenticated && user) {
|
||||
console.log('🔄 User authenticated, redirecting to dashboard...', { user: user.username, authenticated: isAuthenticated });
|
||||
if (import.meta.env.DEV) {
|
||||
console.log('🔄 User authenticated, redirecting to dashboard...', { user: user.username, authenticated: isAuthenticated });
|
||||
}
|
||||
// Force immediate redirect to home page
|
||||
setLocation("/");
|
||||
}
|
||||
|
||||
@@ -628,23 +628,24 @@ export default function BLReconciliation() {
|
||||
|
||||
// Filtrage des livraisons par recherche et statut de validation
|
||||
const filterDeliveries = (deliveries: any[]) => {
|
||||
// Debug temporaire pour production
|
||||
// Debug temporaire pour identifier le problème
|
||||
if (deliveries.length > 0 && filterStatus !== "all") {
|
||||
console.log('🔍 DEBUG Filtre Production:', {
|
||||
console.log('🔍 DEBUG Filtre:', {
|
||||
filterStatus,
|
||||
totalDeliveries: deliveries.length,
|
||||
firstDelivery: {
|
||||
id: deliveries[0].id,
|
||||
reconciled: deliveries[0].reconciled,
|
||||
type: typeof deliveries[0].reconciled,
|
||||
rawValue: JSON.stringify(deliveries[0].reconciled)
|
||||
}
|
||||
exemples: deliveries.slice(0, 3).map(d => ({
|
||||
id: d.id,
|
||||
reconciled: d.reconciled,
|
||||
type: typeof d.reconciled,
|
||||
rawValue: JSON.stringify(d.reconciled),
|
||||
supplier: d.supplier?.name
|
||||
}))
|
||||
});
|
||||
}
|
||||
|
||||
return deliveries.filter((delivery: any) => {
|
||||
// Conversion sûre de reconciled - gestion de tous les cas possibles
|
||||
// PostgreSQL peut retourner : true/false, 1/0, "t"/"f", "true"/"false"
|
||||
// PostgreSQL peut retourner : true/false, 1/0, "t"/"f", "true"/"false", null, undefined
|
||||
const isReconciled =
|
||||
delivery.reconciled === true ||
|
||||
delivery.reconciled === 1 ||
|
||||
@@ -652,12 +653,31 @@ export default function BLReconciliation() {
|
||||
delivery.reconciled === "true" ||
|
||||
(typeof delivery.reconciled === 'string' && delivery.reconciled.toLowerCase() === 'true');
|
||||
|
||||
// Filtre par statut validé
|
||||
if (filterStatus === "validated" && !isReconciled) {
|
||||
return false;
|
||||
// Filtre par statut validé - avec debug pour chaque élément filtré
|
||||
if (filterStatus === "validated") {
|
||||
const keep = isReconciled;
|
||||
if (!keep && delivery.blNumber) {
|
||||
console.log(`❌ Filtré (non validé):`, {
|
||||
id: delivery.id,
|
||||
bl: delivery.blNumber,
|
||||
reconciled: delivery.reconciled,
|
||||
isReconciled
|
||||
});
|
||||
}
|
||||
return keep;
|
||||
}
|
||||
if (filterStatus === "not_validated" && isReconciled) {
|
||||
return false;
|
||||
|
||||
if (filterStatus === "not_validated") {
|
||||
const keep = !isReconciled;
|
||||
if (!keep && delivery.blNumber) {
|
||||
console.log(`❌ Filtré (validé):`, {
|
||||
id: delivery.id,
|
||||
bl: delivery.blNumber,
|
||||
reconciled: delivery.reconciled,
|
||||
isReconciled
|
||||
});
|
||||
}
|
||||
return keep;
|
||||
}
|
||||
|
||||
// Filtre par recherche
|
||||
|
||||
Reference in new issue
Block a user