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:
michaelschal committed 2025-09-21 09:17:20 +00:00
1 parent b51f1ace40
commit 2a23e0da4d
5 files changed
+136 -64

No files matched your search

+19 -13
View File
@@ -28,19 +28,21 @@ import Layout from "@/components/Layout";
function RouterProduction() {
const { isAuthenticated, isLoading, user, environment, error } = useAuthUnified();
// Debug complet pour la production
console.log('🔍 RouterProduction Debug:', {
environment,
isAuthenticated,
isLoading,
hasUser: !!user,
userId: user?.id,
username: user?.username,
error: error?.message
});
// Debug uniquement en développement
if (import.meta.env.DEV) {
console.log('🔍 RouterProduction Debug:', {
environment,
isAuthenticated,
isLoading,
hasUser: !!user,
userId: user?.id,
username: user?.username,
error: error?.message
});
}
// Debug minimal basé sur l'environnement
if (environment === 'production' && error) {
if (environment === 'production' && error && import.meta.env.DEV) {
console.error('🚨 Production Auth Error:', error);
}
@@ -58,7 +60,9 @@ 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');
if (import.meta.env.DEV) {
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">
@@ -109,7 +113,9 @@ function RouterProduction() {
<Route path="/auth">
{() => {
if (typeof window !== 'undefined') {
console.log('🔄 Authenticated user on /auth, redirecting to dashboard');
if (import.meta.env.DEV) {
console.log('🔄 Authenticated user on /auth, redirecting to dashboard');
}
window.location.href = '/';
}
return <Dashboard />;