From 19912ecbe6e9d4aaa3ef339f2cbe68a4770e6e4b Mon Sep 17 00:00:00 2001 From: BOHA Date: Tue, 24 Mar 2026 18:59:21 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20scope=20template=20edit=20=E2=80=94=20re?= =?UTF-8?q?ad=20scope=5Ftemplate=5Fsections=20from=20API=20response?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit API returns scope_template_sections (Prisma relation name) but frontend was reading sections. Now checks both field names. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/admin/pages/OffersTemplates.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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)