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

+20 -10
View File
@@ -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("/");
}