fix: save item position after drag-and-drop reordering
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user