fix: save item position after drag-and-drop reordering

This commit is contained in:
BOHA
2026-03-23 19:06:21 +01:00
parent bfb3a975ea
commit 2b4a98b958

View File

@@ -408,7 +408,7 @@ export default function OfferDetail() {
const response = await apiFetch(url, { const response = await apiFetch(url, {
method: isEdit ? 'PUT' : 'POST', method: isEdit ? 'PUT' : 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ ...form, items, sections: sections.map((s, i) => ({ ...s, position: i })) }) body: JSON.stringify({ ...form, items: items.map((item, i) => ({ ...item, position: i })), sections: sections.map((s, i) => ({ ...s, position: i })) })
}) })
const result = await response.json() const result = await response.json()
if (result.success) { if (result.success) {