Skip to content

Commit 3f91dc0

Browse files
author
jackn
committed
fix: Extract data property when saving templates
After creating/updating a template, backend returns {data: {...}}. Frontend was using the wrapper object instead of the actual template, causing editingTemplate.id to be undefined and preventing Parameters/Parts sections from appearing.
1 parent 4f22581 commit 3f91dc0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

frontend/src/pages/Configurator.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ function Configurator() {
168168
body: JSON.stringify(payload),
169169
});
170170
if (!response.ok) throw new Error("Failed to update template");
171-
const updated = await response.json();
171+
const response_data = await response.json(); const updated = response_data.data || response_data;
172172
setEditingTemplate(updated);
173173
toast.success("Template updated");
174174
} else {
@@ -179,7 +179,7 @@ function Configurator() {
179179
body: JSON.stringify(payload),
180180
});
181181
if (!response.ok) throw new Error("Failed to create template");
182-
const created = await response.json();
182+
const response_data = await response.json(); const created = response_data.data || response_data;
183183
setEditingTemplate(created);
184184
toast.success("Template created");
185185
}

0 commit comments

Comments
 (0)