Fix QR après photo : corriger share.js qui écrasait afficherQR()

share.js était chargé après app.js et redéfinissait afficherQR()
avec l'ancienne version (mauvaise URL, mauvais éléments DOM).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-27 15:20:21 +02:00
parent e81daa7305
commit c7bd92edea
3 changed files with 11 additions and 39 deletions

View File

@@ -180,25 +180,14 @@ async function envoyerEmail() {
}
async function afficherQR() {
const zone = document.getElementById('zone-qr');
zone.classList.toggle('cache');
if (!zone.classList.contains('cache')) {
const booth = config.booth || {};
if (booth.actif && booth.url) {
const info = await apiGet('/api/booth/info').catch(() => null);
const eventId = booth.event_id || 'default';
const pw = info?.password || '';
const qrUrl = `${booth.url}/${eventId}?p=${pw}`;
document.getElementById('img-qr').src = `/api/qr?url=${encodeURIComponent(qrUrl)}`;
} else {
const resultat = await apiGet('/api/qr/galerie');
if (resultat.chemin) {
document.getElementById('img-qr').src = resultat.chemin;
} else {
afficherStatut('QR Code non configure', 'erreur');
zone.classList.add('cache');
}
}
}
const booth = config.booth || {};
if (!booth.actif || !booth.url || !photoFinale) return;
try {
const info = await apiGet('/api/booth/info');
if (!info.password) return;
const eventId = (config.evenement || {}).event_id || booth.event_id || 'default';
const qrUrl = `${booth.url}/g/${eventId}/view/${photoFinale}?p=${info.password}`;
document.getElementById('qr-photo').src = `/api/qr?url=${encodeURIComponent(qrUrl)}`;
document.getElementById('popup-qr').classList.remove('cache');
} catch (e) { console.error('afficherQR error:', e); }
}