Fix: use data.data.item instead of data.item for upload response
EmDash API wraps success responses as { data: { item: ... } },
not { item: ... }. This was causing "Upload failed: no item returned"
even when the upload actually succeeded.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1257,8 +1257,8 @@ export function renderToolbar(config: ToolbarConfig): string {
|
|||||||
return r.json();
|
return r.json();
|
||||||
})
|
})
|
||||||
.then(function(data) {
|
.then(function(data) {
|
||||||
if (!data.item) throw new Error("Upload failed: no item returned");
|
if (!data.data || !data.data.item) throw new Error("Upload failed: no item returned");
|
||||||
var item = data.item;
|
var item = data.data.item;
|
||||||
selectMediaItem(item, annotation, element, imgEl);
|
selectMediaItem(item, annotation, element, imgEl);
|
||||||
})
|
})
|
||||||
.catch(function(err) {
|
.catch(function(err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user