fix: update infraBtn href after render() so ?cv= param is correctly passed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
LIABEUF, Stephane (External) 2026-05-18 02:54:13 +02:00
parent 9474c61c0a
commit 20c8280e4a

View file

@ -3346,9 +3346,6 @@
const cvAllowed = ['ux', 'dsi'];
const cvFile = cvAllowed.includes(cvParam) ? `cv-data-${cvParam}.json` : 'cv-data.json';
const infraBtn = document.getElementById('infraBtn');
if (infraBtn && cvParam) infraBtn.href = `infrastructure.html?cv=${cvParam}`;
fetch(cvFile)
.then(r => {
if (!r.ok) throw new Error('Impossible de charger ' + cvFile + ' (code ' + r.status + ')');
@ -3358,6 +3355,10 @@
render(data);
injectSEO(data);
// Mettre à jour le lien infra APRÈS render (l'élément existe maintenant dans le DOM)
const infraBtn = document.getElementById('infraBtn');
if (infraBtn && cvParam) infraBtn.href = `infrastructure.html?cv=${cvParam}`;
// Restaurer le thème sauvegardé
const saved = localStorage.getItem('cv-theme');
if (saved && ['cyberpunk','bd','itpro','cgi'].includes(saved)) setTheme(saved);