Fix déroulant sommaire PDF : onMounted au lieu de import.meta.client
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Le $fetch dans import.meta.client ne se ré-exécutait pas après hydratation SSR.
onMounted garantit l'exécution côté client après le montage du composant.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Yvv
2026-02-28 22:42:58 +01:00
parent 1af00cc64c
commit df0409fec3

View File

@@ -155,11 +155,11 @@ function setChapterPage(slug: string, val: string) {
}
// Charger le sommaire PDF côté client via l'API serveur
if (import.meta.client) {
onMounted(() => {
$fetch<Array<{ title: string; page: number; level: number }>>('/api/admin/pdf-outline')
.then((data) => { pdfOutline.value = data })
.catch(() => {})
}
.catch((err) => { console.warn('PDF outline load failed:', err) })
})
async function savePdfConfig() {
if (!bookConfig.value) return