diff --git a/frontend/src/pages/MarketEvents.tsx b/frontend/src/pages/MarketEvents.tsx index 73fd406..ec13ddb 100644 --- a/frontend/src/pages/MarketEvents.tsx +++ b/frontend/src/pages/MarketEvents.tsx @@ -520,11 +520,11 @@ function EventDetail({ }) const cd = await cr.json() if (!cr.ok) throw new Error(cd.detail || cr.statusText) - const newTmplId = cd.template?.id ?? cd.template_id + const newTmplId = cd.id ?? cd.template?.id ?? cd.template_id if (newTmplId) { - setTemplates(prev => [...prev, cd.template].filter(Boolean)) + setTemplates(prev => [...prev, { id: newTmplId, name: cd.name, category: cd.category, graph_json: cd.graph_json, instruments: cd.instruments, calibration_json: {} }]) setSelTmpl(newTmplId) - setRecMsg(`✦ Nouveau template créé : ${cd.template?.name ?? 'template'}`) + setRecMsg(`✦ Nouveau template créé : ${cd.name ?? 'template'}`) await instantiate(newTmplId) } else { setRecMsg('Template créé mais ID manquant')