mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-12 01:37:40 +02:00
Fix issues with the credits module by improving client-side debugging and database schema
Add client-side debugging scripts for JavaScript errors and unhandled promise rejections to aid in troubleshooting the credits module. Correct the production database schema for the 'avoirs' table by making 'invoice_reference' and 'amount' columns nullable, and include a test insertion to verify the fix. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869 Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869/mpVybiP
This commit is contained in:
1 parent
d7d918c643
commit
731eb145dd
4 files changed
+290
No files matched your search
@@ -0,0 +1,45 @@
|
||||
// 🔍 DEBUG CLIENT-SIDE ERRORS
|
||||
// Ajoutez ce script dans la console de votre navigateur pour capturer les erreurs
|
||||
|
||||
console.log('🔍 DEBUG AVOIRS - Initialisation...');
|
||||
|
||||
// Intercepter les erreurs React
|
||||
window.addEventListener('error', (event) => {
|
||||
console.error('🚨 ERREUR JAVASCRIPT:', {
|
||||
message: event.message,
|
||||
filename: event.filename,
|
||||
lineno: event.lineno,
|
||||
colno: event.colno,
|
||||
error: event.error
|
||||
});
|
||||
});
|
||||
|
||||
// Intercepter les erreurs de Promise non gérées
|
||||
window.addEventListener('unhandledrejection', (event) => {
|
||||
console.error('🚨 ERREUR PROMISE:', {
|
||||
reason: event.reason,
|
||||
promise: event.promise
|
||||
});
|
||||
});
|
||||
|
||||
// Tester l'accès direct à l'API
|
||||
fetch('/api/avoirs', { credentials: 'include' })
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log('✅ API TEST SUCCESS:', data);
|
||||
console.log('📊 Nombre d\'avoirs:', data.length);
|
||||
if (data.length > 0) {
|
||||
console.log('📋 Premier avoir:', data[0]);
|
||||
console.log('🔍 Structure:', {
|
||||
hasInvoiceReference: data[0].invoiceReference !== undefined,
|
||||
hasAmount: data[0].amount !== undefined,
|
||||
invoiceRefType: typeof data[0].invoiceReference,
|
||||
amountType: typeof data[0].amount
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('❌ API TEST ERROR:', error);
|
||||
});
|
||||
|
||||
console.log('🔍 DEBUG initialisé - surveillez les erreurs ci-dessus');
|
||||
Reference in new issue
Block a user