Handle 3-way merge conflict in editor: show markers, update base_hash
This commit is contained in:
@@ -85,7 +85,16 @@
|
|||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
body: JSON.stringify({ content, base_hash: baseHash }),
|
body: JSON.stringify({ content, base_hash: baseHash }),
|
||||||
});
|
});
|
||||||
if (r.status === 409) { errorMsg = await r.text(); return; }
|
if (r.status === 409) {
|
||||||
|
const data = await r.json();
|
||||||
|
const detail = data.detail ?? {};
|
||||||
|
errorMsg = typeof detail === 'string' ? detail : (detail.message ?? 'Conflitto');
|
||||||
|
if (detail.content) {
|
||||||
|
content = detail.content;
|
||||||
|
baseHash = detail.base_hash ?? baseHash;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!r.ok) throw new Error(await r.text());
|
if (!r.ok) throw new Error(await r.text());
|
||||||
saveStatus = 'Costruendo…';
|
saveStatus = 'Costruendo…';
|
||||||
const rb = await fetch('/rebuild', { method: 'POST', credentials: 'include' });
|
const rb = await fetch('/rebuild', { method: 'POST', credentials: 'include' });
|
||||||
|
|||||||
Reference in New Issue
Block a user