mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Update DLC product fetching to include group filtering, implement precise cache invalidation for DLC-related queries using `exact: false`, and add detailed logging for API requests and responses to aid in debugging. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b163d4c0-de5e-4f4e-a9c0-aed4c7049718 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/b163d4c0-de5e-4f4e-a9c0-aed4c7049718/rEII9fE
70 lines
2.1 KiB
JavaScript
70 lines
2.1 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
// Fix pour invalidation cache DLC - Test avec curl direct
|
|
|
|
const testDlcEndpoint = async () => {
|
|
const { execSync } = require('child_process');
|
|
|
|
console.log('🔍 Test Direct API DLC Products');
|
|
|
|
try {
|
|
// 1. Login admin
|
|
console.log('1. Login admin...');
|
|
const loginResult = execSync(`curl -X POST http://localhost:5000/api/login \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"username":"admin","password":"admin"}' \
|
|
-c cookies.txt \
|
|
-w "%{http_code}" \
|
|
-s`, { encoding: 'utf8' });
|
|
|
|
console.log('Login status:', loginResult.slice(-3));
|
|
|
|
// 2. Test GET DLC products
|
|
console.log('2. GET DLC products...');
|
|
const dlcResult = execSync(`curl -X GET http://localhost:5000/api/dlc-products \
|
|
-b cookies.txt \
|
|
-w "%{http_code}" \
|
|
-s`, { encoding: 'utf8' });
|
|
|
|
const statusCode = dlcResult.slice(-3);
|
|
const responseBody = dlcResult.slice(0, -3);
|
|
|
|
console.log('Status:', statusCode);
|
|
|
|
if (statusCode === '200') {
|
|
const dlcs = JSON.parse(responseBody);
|
|
console.log('✅ Total DLC:', dlcs.length);
|
|
|
|
if (dlcs.length > 0) {
|
|
console.log('📋 Sample DLC:', {
|
|
id: dlcs[0].id,
|
|
productName: dlcs[0].productName,
|
|
groupId: dlcs[0].groupId,
|
|
status: dlcs[0].status
|
|
});
|
|
|
|
// Grouper par groupId
|
|
const byGroup = dlcs.reduce((acc, dlc) => {
|
|
acc[dlc.groupId] = (acc[dlc.groupId] || 0) + 1;
|
|
return acc;
|
|
}, {});
|
|
|
|
console.log('📊 DLC par groupe:', byGroup);
|
|
}
|
|
} else {
|
|
console.log('❌ Erreur:', responseBody);
|
|
}
|
|
|
|
console.log('\n3. Instructions debug frontend:');
|
|
console.log('- Ouvrir DevTools Network');
|
|
console.log('- Recharger page DLC Products');
|
|
console.log('- Vérifier si requête API est envoyée');
|
|
console.log('- Vérifier la réponse de l\'API');
|
|
console.log('- Vérifier React Query cache dans Components');
|
|
|
|
} catch (error) {
|
|
console.log('❌ Erreur:', error.message);
|
|
}
|
|
};
|
|
|
|
testDlcEndpoint(); |