feat: causal lab
This commit is contained in:
@@ -520,11 +520,11 @@ function EventDetail({
|
|||||||
})
|
})
|
||||||
const cd = await cr.json()
|
const cd = await cr.json()
|
||||||
if (!cr.ok) throw new Error(cd.detail || cr.statusText)
|
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) {
|
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)
|
setSelTmpl(newTmplId)
|
||||||
setRecMsg(`✦ Nouveau template créé : ${cd.template?.name ?? 'template'}`)
|
setRecMsg(`✦ Nouveau template créé : ${cd.name ?? 'template'}`)
|
||||||
await instantiate(newTmplId)
|
await instantiate(newTmplId)
|
||||||
} else {
|
} else {
|
||||||
setRecMsg('Template créé mais ID manquant')
|
setRecMsg('Template créé mais ID manquant')
|
||||||
|
|||||||
Reference in New Issue
Block a user