diff --git a/src/admin/pages/OffersTemplates.tsx b/src/admin/pages/OffersTemplates.tsx index e492333..5e79e33 100644 --- a/src/admin/pages/OffersTemplates.tsx +++ b/src/admin/pages/OffersTemplates.tsx @@ -360,10 +360,11 @@ function ScopeTemplatesTab() { const result = await response.json() if (result.success) { setEditingTemplate(result.data) + const templateSections = result.data.scope_template_sections || result.data.sections || [] setForm({ name: result.data.name || '', - sections: result.data.sections?.length - ? result.data.sections.map((s: { title?: string; title_cz?: string; content?: string }) => ({ _key: `sc-${++sectionKeyCounter.current}`, title: s.title || '', title_cz: s.title_cz || '', content: s.content || '' })) + sections: templateSections.length + ? templateSections.map((s: { title?: string; title_cz?: string; content?: string }) => ({ _key: `sc-${++sectionKeyCounter.current}`, title: s.title || '', title_cz: s.title_cz || '', content: s.content || '' })) : [{ _key: `sc-${++sectionKeyCounter.current}`, title: '', title_cz: '', content: '' }] }) setShowModal(true)